modal dialog

A window laid over the page that users must deal with before returning to the page beneath, with role="dialog" and aria-modal="true".

In more detail

A modal dialog needs an accessible name (usually aria-labelledby pointing at its heading), a focus trap, focus restoration on close, dismissal with Escape, and an inert background. Standard dialogs may close on a backdrop click; alert dialogs may not. HTML's native <dialog> element with showModal() provides much of this.

Examples

In the browser: An accessible modal traps keyboard focus inside itself, closes with Escape and returns focus to the control that opened it. The native dialog element opened with showModal() does all three.
React modals are usually rendered through a portal so parent CSS cannot clip them.

Related terms

Taught in

References