Watch
Modal dialog 0:37
A 37-second explainer of Modal dialog, narrated over the same demo you can try yourself.
Try the interactive Modal dialog demo
What this video covers
A modal dialog blocks interaction with the page behind it while open. Focus should enter the modal, stay within its controls, and return to the trigger when it closes. Some modals ask for a decision; others just present information or a short task. It becomes a keyboard trap only when there’s no reliable way to complete or dismiss it - not because focus is contained.
In the broken dialog, Tab leaked out to the page behind and Escape did nothing - so a keyboard user could lose the dialog, or get stranded in it. The accessible one kept focus inside, closed on Escape, and handed focus back to the button you came from. Same window; completely different experience depending on who is at the keyboard.