Resonance Logo

Modal

A modal dialog overlays the page to present content or request a decision, blocking interaction with the rest of the interface until it is dismissed.

Demo

Click the "Open Modal" button to launch the dialog. While the modal is open, try pressing Tab to cycle through focusable elements and Escape to close it. Confirm that focus returns to the trigger button after the modal closes.

What to Observe

Anatomy

[Anatomy image placeholder — will be added when assets are available]

  1. Backdrop / overlay: The dimmed layer covering the page that signals the modal is active and prevents interaction with background content.
  2. Dialog container: The panel that holds all modal content, marked up with the dialog role and an accessible name.
  3. Dialog title: The heading inside the dialog that names the purpose of the modal, used as its accessible label.
  4. Body content: The main message, form, or information displayed within the dialog.
  5. Action buttons: Buttons that confirm, cancel, or otherwise resolve the modal's purpose.
  6. Close button: An explicit control, typically in the header area, that dismisses the modal.

Accessibility Behavior

Common Mistakes

Why This Matters

Modals interrupt the normal page flow and demand a user's attention. When focus management is broken, keyboard and screen reader users can become disoriented — either stuck inside a dialog they cannot exit or dropped back at the top of the page after closing one. Proper focus trapping and restoration ensure that modals feel predictable and safe for everyone, preventing the frustration of losing one's place in a complex workflow.

Accessibility Validation

This component is validated against internal accessibility criteria aligned with WCAG standards, using our internally developed system, Resonance Specs.

To learn more, please contact us.

Code

Reference Implementation