liveBook · Manning

Dialog element

As explained in Architecting Accessibility

The HTML dialog element represents a modal or non-modal dialog interface with browser-supported dialog behavior.

For a modal dialog, keep keyboard focus inside until the dialog is dismissed. Otherwise, someone navigating with a keyboard may move into background content and lose track of where they are. section 5.3.2

document.getElementById(“modal_title”).focus()

A dialog heading can receive focus when the modal opens: give it tabindex="-1", then call focus() on it. section 5.3.2

How Architecting Accessibility covers it

How deep it goes
Explains modal focus containment and a heading-focus example, but stops short of dialog construction or browser internals.
Examples
Uses a modal heading with tabindex="-1" and a JavaScript focus() call as an initial-focus example.
What you can do after
Apply focus management by moving focus to a dialog heading and keeping it inside the modal until dismissal.
How it connects
Connects modal dialogs with keyboard navigation, focus order, and assistive technology.

Also explained in

Compare how 2 books explain dialog element →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Architecting Accessibility. The section links point to the parts of the book it draws on.