Modal Dialog
A modal dialog is an overlaid window that temporarily blocks interaction with the underlying interface until the user responds or dismisses it.
Download Markdown (.md)Soroush’s Product Wiki · https://wiki.soroush.uk/topic/modal-dialog/
01What it means
A dialog presents a focused task or message in a window above the current interface. A modal dialog makes the rest of the interface inert; a non-modal dialog does not. Modality is a behavioral constraint, not merely a dimmed backdrop or centered panel.[1][2]
02Why it matters
Dialogs can focus attention without sending people to another page, but they interrupt context and create demanding focus, keyboard, dismissal, and responsive-layout requirements. Choosing modality deliberately prevents routine information from becoming an unnecessary barrier.
03When to use it
Use a modal dialog for a short, self-contained task, consequential confirmation, or information that must be handled before work continues. Prefer inline content, a new page, or a non-modal surface when users need to compare information, multitask, or complete a long workflow.
04How it works
- Define the single task or decision that justifies interrupting the current context.
- Give the dialog a visible title, concise content, clear actions, and an explicit close route.
- Make background content inert and move focus to an appropriate element inside the dialog.
- Keep keyboard focus within the modal while open and support Escape when dismissal is safe.
- On close, return focus to the trigger or another logical surviving control and preserve prior page state.
05A practical example
An account owner chooses to delete a workspace. A modal explains the irreversible effect, names the workspace, offers Cancel and Delete, and initially focuses the safer action. After cancellation, focus returns to the delete trigger without losing page state.
06Where it breaks
Dialogs reduce visible context, can become cramped at high zoom or on small screens, and are easy to make inaccessible. Nested dialogs and long forms compound cognitive and navigation costs; a modal cannot rescue an unclear decision or workflow.
Common mistakes
- Using a modal for passive information or routine success messages.
- Styling an overlay as modal while leaving background content interactive.
- Failing to define initial focus, keyboard containment, dismissal, and focus return.
- Placing a long multi-step workflow in a small dialog.
07Sources
- Dialog (Modal) PatternW3C Web Accessibility Initiative · Technical guidanceDialog (Modal) Pattern
- ModalityApple · Institutional guidelineModality