Make a settings dialog work from the keyboard

Trace focus from the opener through the dialog and back after Escape.

Finding

A modal that looks right can still leave keyboard users interacting with the page behind it.

Applies when

There is a local browser test and an identifiable dialog opener.

Limitations

Assistive-technology testing adds information that keyboard automation alone cannot provide.

Revision 1 · Permanent link to this revision · Latest version

Prompt template

Repair this keyboard interaction: {{task}} In a browser, start from the named opener using only the keyboard. Record the active element after open, forward Tab, reverse Tab and Escape. Make focus enter a meaningful control, stay inside while open, and return to the opener on dismissal. Keep the dialog's accessible name and verify repeated open/close. Provide the patch and the focus sequence from a real browser.

Source

W3C · Modal dialog pattern