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 and PageSpeed Insights
Elements with role="dialog" or role="alertdialog" do not have accessible names.
axe-core, axe DevTools and this checker
ARIA dialog and alertdialog nodes should have an accessible name (rule aria-dialog-name)

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

  1. Run the checker with “Also show best-practice suggestions” ticked, with the dialog open: the report shows the dialog element.
  2. Search your code for role="dialog" and role="alertdialog" without aria-labelledby or aria-label. Modal libraries, cookie banners and chat widgets are the usual places.

How to fix it

  1. Give the dialog’s heading an id, and add aria-labelledby with that id to the dialog.
  2. If the dialog has no visible heading, add aria-label with a short name.
  3. For an alertdialog, also point aria-describedby at 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

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

More detail