Modal dialogs
A dialog that blocks everything costs attention, and it is worth that only when a decision truly must come first.
The answer
Use a modal only when people must respond before anything else, and only after their own action. As strong as the weakest rule behind it: moderate.
-
Use a modal dialog only when people must respond before anything else can continue. Put everything else on the page.
NN/g, USWDS and Carbon agree that modals are for critical or blocking decisions and should be rare. One study (100 students) found fixing an error about a second faster with an in-page message than with a popup. Interruption research points the same way but is not about dialogs.
- Applies when
- Deciding whether to interrupt.
- Based on
- Practitioner research
- Principle
- Keep people in control
- ExperimentExperiment: hofseth-2019-popup-vs-inform
- User researchUser research: Modal & Nonmodal Dialogs: When (& When Not) to Use ThemTherese Fessenden, 2017
- User research: Popups (NN/g article by Anna Kaley)Anna Kaley, 2019
- GuidanceGuidance: Modal (U.S. Web Design System)USWDS / GSA
- Guidance: carbon-2025-modal-danger
-
Open a modal only in response to something people did, except for warnings they must see, such as an expiring session.
USWDS and NN/g agree. One small study (13 students) found most people opened dialogs they could choose to open and liked the choice; it had no comparison with automatic ones.
- Applies when
- Deciding what triggers a dialog.
- Based on
- Practitioner research
- Principle
- Keep people in control
- Common mistake
- A newsletter or promotion dialog that opens by itself.
- ExperimentExperiment: The polite pop-up: An experimental study of pop-up design characteristics and user experienceWillermark, 2020
- User researchUser research: Popups (NN/g article by Anna Kaley)Anna Kaley, 2019
- GuidanceGuidance: Modal (U.S. Web Design System)USWDS / GSA
The other rules
-
People must be able to leave a modal with the keyboard alone.
WCAG 2.2 success criterion 2.1.2 No Keyboard Trap, level A. Holding focus in a dialog is allowed because the person can leave by a control or Escape.
- Applies when
- Focus is held inside a dialog.
- Based on
- Standard or law
- Principle
- Work for everyone
- Common mistake
- A dialog with no keyboard way out.
- StandardStandard: Understanding SC 2.1.2: No Keyboard TrapW3C WAI
-
While a modal is open, block the rest of the page and keep keyboard focus inside the dialog.
The HTML standard makes the rest of the document inert for a modal dialog and the ARIA practices guide (non-binding) says the same. Neither is a conformance requirement on products, so no floor; rated on agreement.
- Applies when
- A modal dialog is open.
- Based on
- Standard or law
- Principle
- Work for everyone
- StandardStandard: HTML Standard: the dialog elementWHATWG
- GuidanceGuidance: apg-2026-dialog-modal
- Guidance: Modal (U.S. Web Design System)USWDS / GSA
-
Close on Escape, and show a Close button.
APG, the HTML standard's default and Primer agree. WCAG treats Escape as a usual exit but does not require it.
- Applies when
- Any modal dialog that can be dismissed.
- Based on
- Practitioner research
- Principle
- Keep people in control
- StandardsStandard: HTML Standard: the dialog elementWHATWG
- Standard: Understanding SC 2.1.2: No Keyboard TrapW3C WAI
- GuidanceGuidance: apg-2026-dialog-modal
- Guidance: Dialog (GitHub Primer React component)GitHub Primer
-
Show one modal at a time.
NN/g reports stacked popups as a problem, without method. The HTML standard allows stacking and gives no usability guidance.
- Applies when
- A second dialog could open over the first.
- Based on
- Practitioner research
- Principle
- Leave out what is not needed
- Common mistake
- Dialogs stacked on dialogs.
- User researchUser research: Popups (NN/g article by Anna Kaley)Anna Kaley, 2019
- StandardStandard: HTML Standard: the dialog elementWHATWG
-
Don’t ask for a decision in a modal when the information needed is hidden behind it.
One practitioner article, argued from examples.
- Applies when
- The decision depends on content behind the dialog.
- Based on
- Practitioner research
- From research on
- Recognition is more accurate than recall
- Principle
- Recognition over recall
- User researchUser research: Modal & Nonmodal Dialogs: When (& When Not) to Use ThemTherese Fessenden, 2017
-
Close a modal on an outside click only when nothing typed or chosen would be lost.
The HTML standard's default for modal dialogs does not close on outside click but allows opting in. USWDS can block closing until a choice is made. No study found.
- Applies when
- Deciding on outside-click dismissal.
- Based on
- Convention
- Principle
- Keep people in control
- StandardStandard: HTML Standard: the dialog elementWHATWG
- GuidanceGuidance: Modal (U.S. Web Design System)USWDS / GSA
Accessibility
- WCAG 2.2 · 2.1.2WCAG 2.1.2 (A): no keyboard trap.
- WCAG 2.2 · 2.4.3WCAG 2.4.3 (A) and 2.4.11 (AA): see Focus management on open and close.Focus management on open and close
- Name the dialog by its heading (USWDS, APG).
Open questions
- OpenDo modal dialogs cause more errors or abandonment than in-page alternatives? One small study on error messages only.
- OpenOutside-click dismissal: no evidence.
- OpenNo systematic review or large online experiment on modal dialogs was found.
Sources
- ExperimentsExperiment: hofseth-2019-popup-vs-inform
- Experiment: The polite pop-up: An experimental study of pop-up design characteristics and user experienceWillermark, 2020
- User researchUser research: Modal & Nonmodal Dialogs: When (& When Not) to Use ThemTherese Fessenden, 2017
- User research: Popups (NN/g article by Anna Kaley)Anna Kaley, 2019
- StandardsStandard: HTML Standard: the dialog elementWHATWG
- Standard: Understanding SC 2.1.2: No Keyboard TrapW3C WAI
- GuidanceGuidance: Modal (U.S. Web Design System)USWDS / GSA
- Guidance: carbon-2025-modal-danger
- Guidance: apg-2026-dialog-modal
- Guidance: Dialog (GitHub Primer React component)GitHub Primer
Related
- Focus management on open and closeMove focus into a dialog when it opens, and back to the control that opened it when it closes.Answer: moderate.
- Confirmation dialogsConfirm rarely, label the buttons with what they do, and for severe actions make people engage with the detail.Answer: moderate.
- PopoversOpen popovers on click, not hover, and close them with Escape or a click outside.Answer: moderate.
- DrawersPut a panel beside the content when people need both, and send long work to its own page.Answer: moderate.
- Error message contentSay which field is wrong and how to fix it, right next to the field.Answer: strong.