Elements with role="dialog" or role="alertdialog" do not have accessible names
How to fix the aria-dialog-name accessibility rule. ARIA. A best practice, not a WCAG requirement.
The message you saw
Lighthouse runs axe-core inside it, so both are the same check, and the fix below works whichever tool showed you the message.
What it means
When a dialog opens, a screen reader announces its name, so the user knows what just appeared: “Sign up for our newsletter, dialog”. This message means an element marked with role="dialog" or role="alertdialog" has no name, so it is announced as just “dialog”.
A heading inside the dialog doesn’t count by itself. The name has to be attached with aria-labelledby (pointing at the heading) or aria-label.
Who is affected
A dialog has no name, so screen readers announce just "dialog" and users don't know what opened.
Screen-reader users hear that something opened, but not what it is, so they have to read through it to find out whether it is a cookie notice, an error or a form. It is a best practice in axe, but naming dialogs is part of the ARIA dialog pattern.
How to find it
- Run the checker with “Also show best-practice suggestions” ticked, with the dialog open: the report shows the dialog element.
- Search your code for
role="dialog"androle="alertdialog"withoutaria-labelledbyoraria-label. Modal libraries, cookie banners and chat widgets are the usual places.
How to fix it
- Give the dialog’s heading an
id, and addaria-labelledbywith that id to the dialog. - If the dialog has no visible heading, add
aria-labelwith a short name. - For an
alertdialog, also pointaria-describedbyat the message text, so it is read straight away.
Example
Before
<div role="dialog" aria-modal="true">
<h2>Get our newsletter</h2>
…
</div>After
<div role="dialog" aria-modal="true" aria-labelledby="nl-title">
<h2 id="nl-title">Get our newsletter</h2>
…
</div>Common mistakes
- The native
<dialog>element isn’t checked by this rule, but it needs a name just as much. Usearia-labelledbyon it the same way. - A
titleattribute also gives the dialog a name and passes, butaria-labelledbykeeps the spoken name the same as the visible heading.
WCAG success criteria
None. This is a best practice: fixing it helps people using assistive technology, but it doesn’t affect WCAG conformance. Our scanner only reports it if you tick “Also show best-practice suggestions”.
Check your fix
Scan a web page and the report lists every element that fails this rule, with screenshots outlining where they are, the code, and a selector you can paste into your browser’s developer tools. Scan again after your change: when the rule no longer appears under the problems, the fix worked.
An automated pass means this rule found nothing wrong. It doesn’t prove the page is accessible: some of what WCAG asks for needs a person to check, and the report’s manual checklist lists those steps.
Related fix guides
[aria-hidden="true"]is present on the document<body>- ARIA
tooltipelements do not have accessible names - Buttons do not have an accessible name
button,link, andmenuitemelements do not have accessible names
More detail
- Deque University’s reference for aria-dialog-name (the makers of axe-core, the engine our scanner uses)
- All fix guides