Build Keyboard-Operable Dialogs and Popovers
8 steps · about 3 h 5 min · Intermediate
- Study the modal dialog pattern (reference, WAI-ARIA APG, 25 min)
Identify required roles, names, focus placement, tab containment and Escape behavior.
- Test a working dialog example (interactive, WAI-ARIA APG, 25 min)
Use keyboard and accessibility inspection to connect the pattern to concrete behavior.
- Start with the native dialog element (reference, MDN Web Docs, 25 min)
Understand showModal, close, backdrop behavior and the platform semantics available by default.
- Handle user cancellation (reference, MDN Web Docs, 15 min)
Respond to Escape and other platform cancellation without losing application state.
- Move focus intentionally (reference, MDN Web Docs, 20 min)
Place focus on a useful control and avoid surprise scrolling when an overlay opens.
- Make the background inactive (reference, MDN Web Docs, 20 min)
Prevent interaction with content outside a modal using the platform inert model.
- Compare non-modal popovers (reference, MDN Web Docs, 25 min)
Choose a popover when focus trapping and modal behavior would be inappropriate.
- Run keyboard and screen-reader checks (guide, W3C Web Accessibility Initiative, 30 min)
Verify open, traversal, dismissal, focus return, zoom and labels with manual checks.