Escape key
The keyboard key that, by convention, closes the topmost overlay such as a dialog, menu, popover or tooltip.
In more detail
Every overlay should close on Escape and, where it took focus, return focus to its trigger. It is also the required way out of a focus trap.
Related terms
- focus trap — Code that keeps keyboard focus inside a container, such as an open modal, wrapping from the last element back to the first.
- focus restoration — Returning keyboard focus to the element that opened an overlay, such as its trigger button, when the overlay closes.
- overlay — Any piece of interface that appears on top of the page, such as a modal dialog, popover, tooltip, menu or toast.
Taught in
- Focus Management: Trapping, Restoration & Focus Rings — Design Systems & Component Engineering
- Modal Dialogs & Alert Dialogs: Accessible Overlay Patterns — Design Systems & Component Engineering
- Floating Primitives: Popovers, Tooltips & Positioning — Design Systems & Component Engineering
- Navigation & Disclosure: Dropdown Menus, Tabs & Accordions — Design Systems & Component Engineering