# Modal Dialog

A modal dialog is an overlaid window that temporarily blocks interaction with the underlying interface until the user responds or dismisses it.

- Type: artifact
- Domain: Experience & interface
- Level: Foundational
- Last reviewed: 2026-09-24
- Original: [Soroush’s Product Wiki](<https://wiki.soroush.uk/topic/modal-dialog/>)

## What 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.

## Why 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.

## When 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.

## How it works

1. Define the single task or decision that justifies interrupting the current context.
2. Give the dialog a visible title, concise content, clear actions, and an explicit close route.
3. Make background content inert and move focus to an appropriate element inside the dialog.
4. Keep keyboard focus within the modal while open and support Escape when dismissal is safe.
5. On close, return focus to the trigger or another logical surviving control and preserve prior page state.

## A 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.

## Where 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.

## Sources

1. [Dialog \(Modal\) Pattern](<https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/>) — W3C Web Accessibility Initiative · Technical guidance
2. [Modality](<https://developer.apple.com/design/human-interface-guidelines/modality>) — Apple · Institutional guideline

## Related topics

- [Focus Management](<https://wiki.soroush.uk/topic/focus-management/>)
- [Progressive Disclosure](<https://wiki.soroush.uk/topic/progressive-disclosure/>)
- [Error Prevention](<https://wiki.soroush.uk/topic/error-prevention/>)
