ARIA Window Roles
ARIA role: alertdialog
An urgent dialog that requires the user to respond before continuing. Name the dialog, describe its message, move focus inside, contain focus when modal, restore focus on close. Static structure only; implement actions and modal behavior. 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="alertdialog"Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| role | token | Explicit role token alertdialog; use only where allowed. Omit when native semantics match. |
| aria-modal | boolean | Relevant 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-labelledby | ID reference list | Relevant 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. |
| aria-describedby | ID reference list | Relevant when applicable. Connects an element to supplementary descriptive text. Keep its accessible name separate and concise; descriptions can explain constraints or consequences. References may point to hidden text under accessible-name calculation rules. Values: space-separated IDs of descriptive elements. |
Working Example
Example Snippethtml
<div role="alertdialog" aria-modal="true" aria-labelledby="title" aria-describedby="msg"> <h2 id="title">Discard changes?</h2> <p id="msg">Unsaved edits will be lost.</p> <button>Cancel</button> <button>Discard</button></div>