dialog-name-present

Dialogs have an accessible name

automaticWCAG 4.1.2 (A)confidence: highseverity: seriousrobust

Checks that elements with role="dialog" or role="alertdialog" expose a non-empty accessible name.

Applies to. Applies to elements carrying role="dialog" or role="alertdialog" (the attribute must name one of those roles alone, not a fallback list) that are included in the accessibility tree. A native <dialog> without an explicit role is out of scope.

Expectation. The element has a non-empty accessible name from aria-label, from an aria-labelledby that resolves to non-empty text, or from title. Both roles are name-from-author-only, so the heading or body text inside the dialog is not accepted as its name unless aria-labelledby points at it.

Examples

pass
<div role="dialog" aria-label="Confirm deletion">
<p>Are you sure?</p>
</div>

`aria-label` names the dialog.

fail
<div role="dialog">
<p>Body text only.</p>
</div>

No accessible name; visible body text doesn't count toward a dialog's name.

View source