ARIA Window Roles

ARIA role: dialog

A separate window-like interaction within a page. Prefer native dialog. A custom modal needs focus management, inert background, dismissal, accessible name and focus restoration. The example demonstrates a native equivalent or preferred alternative and deliberately omits redundant ARIA. Explicit roles do not implement visual presentation, interaction or focus management; verify allowed role/element combinations in ARIA in HTML. Accessibility exposure varies with browser, platform and assistive technology. Test relevant combinations; rendering is not proof of accessibility.

Formal Syntax & Structure

html syntaxhtml
role="dialog"

Parameters & Attributes

NameTypeDescription
roletokenExplicit role token dialog; use only where allowed. Omit when native semantics match.
aria-modalbooleanRelevant when applicable. Indicates a dialog is modal, with content outside it unavailable for interaction. It does not enforce modality, trap focus or hide surrounding content on its own. Only set true when behavior really is modal; prefer native showModal(). Values: true, false.
aria-labelledbyID reference listRelevant when applicable. Computes an accessible name from referenced elements in the listed order. It takes precedence over aria-label in applicable name computation. Ensure IDs exist; prefer native label for form controls where possible. Values: space-separated IDs of name-providing elements.

Working Example

Example Snippethtml
<button id="open">Open</button><dialog id="d" aria-labelledby="t">  <h2 id="t">Settings</h2>  <form method="dialog">    <button>Close</button>  </form></dialog><script>  document.getElementById('open').onclick=()=>document.getElementById('d').showModal()</script>
HTML Reference