Skip to content

Dialog

A titled panel that takes focus: modal over an inert page, or non-modal in the page flow. Focus returns to its trigger on close.

Maturity
beta
Links
Storybook · Figma · Spec source · Usage source

Use cases

People using assistive technology should be able to:

  • Hear the dialog's title, and its description when there is one, as soon as it opens.
  • Close it with Escape or the Close button and land back on the control that opened it.
  • Reach every control in the dialog with Tab, without reaching the page behind a modal dialog.
  • Start on the safe choice, such as Cancel, when the action can't be undone.

Reading order

The title names the dialog and the description is read with it, so write the title as the question or task ("Remove this course?"). The Close button is labelled for you and comes right after the title.

Remove this course?

Your progress in Color Theory II will be deleted. This can't be undone.

The dialog is named by its title and described by its description. The icon-only Close button has its own label.

Keyboard and focus

Escape and the Close button close the dialog, and focus goes back to the control that opened it. Focus starts on the title; to start on Cancel instead, mark it data-autofocus, never with React's autoFocus.

Remove this course?

Your progress in Color Theory II will be deleted. This can't be undone.

Focus opens on Cancel, so Enter can't remove the course by accident. Tab moves on to Remove, then wraps to Close.

Every component follows ADR-025, ADR-026 and ADR-028(states, prop vocabulary, focus indicator); they are not repeated per component.