Elements with role="dialog" or role="alertdialog" have accessible names

Dialog boxes have labels so screen readers can describe their purpose.

On this page

Impact

ScanGov impact ratings

About

ARIA dialog elements without accessible names may prevent screen readers users from discerning the purpose of these elements. [Learn how to make ARIA dialog elements more accessible](https://dequeuniversity.com/rules/axe/4.10/aria-dialog-name).

Risks

Screen readers cannot tell users what a dialog box is for.

Why it's important

Ensures assistive technologies like screen readers can correctly interpret and announce page elements to users with disabilities.

User stories

As a screen reader user, I want ARIA attributes to be correctly implemented so that I can understand the purpose and state of interactive elements.

Code

Failing pattern:

<!-- Fail: dialog with no accessible name -->
<div role="dialog">...</div>

Passing pattern:

<!-- Pass: aria-labelledby references a visible heading -->
<div role="dialog" aria-labelledby="dialog-title">
  <h2 id="dialog-title">Confirm your submission</h2>
  ...
</div>

Error

ScanGov messaging when a site fails a standard:

Failed: Elements with role="dialog" or role="alertdialog" have accessible names

Guidance

Indicators

On this page