Escape to Close and Restore Focus
Give a reliable exit that returns the user back.
Every Modal Needs an Exit
A modal that you cannot leave is a trap. Users expect a fast, reliable way to close it without hunting for a tiny button.
Escape Is the Universal Key
The Escape key is the agreed shortcut to dismiss a dialog. Keyboard and screen reader users reach for it first, so always support it.
All lessons in this course
- Dialog Roles and the Native dialog Element
- Trapping Focus Inside the Modal
- Escape to Close and Restore Focus
- Inert Background and aria-modal