Modal dialogs are perfect for drawing your user’s attention to important information or actions. This example demonstrates how to build a lightweight, accessible modal using vanilla JavaScript.
Focus is moved into the modal when it opens, and returned to the trigger when it closes. You can add any content here—forms, confirmations, promotions, or onboarding messages.