Dialog without an accessible name (aria-dialog-name)

The aria-dialog-name rule flags an element with role="dialog" or role="alertdialog" that has no accessible name. When the dialog opens, a screen reader announces "dialog" and nothing about what it is for. The fix is almost always one attribute: aria-labelledby pointing to the dialog's visible heading.

What the rule means

A dialog is a window on top of the page: a cookie banner, a login form, a "remove item?" confirmation, a cart drawer. Its name is what assistive technology reads when focus moves into it. axe accepts three ways to give one:

  • aria-labelledby pointing to an element with text, usually the heading;
  • aria-label with the name as text, where there is no visible heading;
  • a non-empty title attribute – valid, but the weakest of the three.

The rule only tests elements with an explicit role="dialog" or role="alertdialog", and only while they are displayed. A native <dialog> element without a role attribute is not checked by it at all, though it needs a name just as much.

This is a best practice, not a WCAG failure in itself. It relates to two criteria: 4.1.2 Name, Role, Value, because a dialog is a user interface component whose name should be available to assistive technology, and 2.4.6 Headings and Labels, because a name only helps if it describes the dialog's purpose.

Who is affected

Mainly blind and partially sighted people using a screen reader. When focus jumps into an unnamed dialog, they hear "dialog" followed by whatever element got focus – often just "Close, button" – and must explore the dialog to find out whether it is asking for consent, a password or confirmation to delete something. Screen magnifier users, who see only part of the screen, benefit from a clear name as well.

Why the check fails

  • Modal libraries and UI kits that set role="dialog" on the container but leave naming to the developer, who never passes a title.
  • Cookie consent banners built as dialogs with a heading that is not linked to the container.
  • A visible heading without an id, so aria-labelledby has nothing to point to.
  • aria-labelledby to an id that does not exist, after the heading was renamed or removed.
  • Confirmation dialogs (role="alertdialog") with only a message and two buttons.
  • Chat and newsletter pop-ups injected by third-party scripts.

How to fix it

  1. Give the dialog's visible heading an id and point aria-labelledby to it. Visible and spoken name are then the same.
  2. With no heading, use aria-label with a short, specific name – "Cookie settings", not "Dialog".
  3. For an alertdialog, also link the message with aria-describedby, so it is read out together with the name.
  4. Fix it once in the modal component; every dialog built from it inherits the name.
<!-- Before: the dialog has a heading, but nothing links it to the dialog -->
<div class="cookie-modal" role="dialog" aria-modal="true">
  <h2 class="cookie-modal__title">Cookie settings</h2>
  <p>We only use cookies that keep the shop working.</p>
  <button class="btn btn--primary">Accept necessary cookies</button>
</div>
<!-- After: aria-labelledby names the dialog after its visible heading -->
<div class="cookie-modal" role="dialog" aria-modal="true" aria-labelledby="cookie-title">
  <h2 class="cookie-modal__title" id="cookie-title">Cookie settings</h2>
  <p>We only use cookies that keep the shop working.</p>
  <button class="btn btn--primary">Accept necessary cookies</button>
</div>

A native <dialog> needs the same name, even though this rule does not look at it:

<!-- Native dialog: name it the same way -->
<dialog class="confirm" aria-labelledby="confirm-title" aria-describedby="confirm-text">
  <h2 id="confirm-title">Remove item?</h2>
  <p id="confirm-text">The walking boots will be removed from your basket.</p>
  <button>Remove</button> <button>Cancel</button>
</dialog>

How to test it manually

  1. Open every dialog on the page – cookie banner, login, cart, confirmations – because the rule only sees dialogs that are displayed while the page is scanned.
  2. In the browser's developer tools, select the dialog container and check its name in the Accessibility pane.
  3. With a screen reader such as NVDA (free) or VoiceOver, open the dialog and listen: you should hear its name and "dialog" as focus moves in.
  4. Check that the name says what the dialog is for. "Modal" or "Popup" passes the rule and helps nobody.

None directly – aria-dialog-name is a best practice. It relates to 4.1.2 Name, Role, Value and 2.4.6 Headings and Labels. A dialog that traps or loses keyboard focus is a separate matter for 2.1.2 No Keyboard Trap.

How Reviseberg reports it

Reviseberg runs aria-dialog-name on every crawled page. The issue list shows the rule as a best practice with its severity, the number of elements and pages, and the points a fix gets you back; it never counts against a WCAG criterion and never appears in a compliance report or accessibility statement. The detail view shows the selector and HTML snippet of each dialog and every affected page. The rule only sees dialogs that are displayed when the page is scanned: a cookie banner shown on arrival is tested, a dialog that stays hidden until somebody clicks is not – check those by hand. Findings can be marked "ignore", "can't fix" or "false positive" with a reason, for example for a third-party widget you cannot change; every decision is logged.

  • undefined – the close button inside a dialog often has no name either.
  • undefined – content behind an open modal hidden with aria-hidden, but still reachable by keyboard.
  • undefined – the keyboard agent's check for focus that cannot leave a component.

Check the dialogs on your site – get a free scan

Frequently asked questions

Is a dialog without a name a WCAG failure?

axe-core files aria-dialog-name as a best practice, and Reviseberg reports it that way. It supports 4.1.2 and 2.4.6, and screen reader users feel the difference immediately.

Should I use aria-label or aria-labelledby?

aria-labelledby wherever the dialog has a visible heading, so the spoken name matches what people see. aria-label only where there is no heading.

Why does the rule not flag my <dialog> element?

It only tests elements with an explicit role="dialog" or role="alertdialog". A native <dialog> is a dialog all the same – name it with aria-labelledby.

Does aria-modal="true" give the dialog a name?

No. It tells assistive technology that the content behind is inert; the name still has to come from aria-labelledby, aria-label or title.

Sources

  1. Deque University, axe-core 4.13 rule aria-dialog-name – https://dequeuniversity.com/rules/axe/4.13/aria-dialog-name
  2. W3C, ARIA Authoring Practices Guide: Dialog (Modal) pattern – https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/
  3. W3C, Accessible Rich Internet Applications (WAI-ARIA) 1.2, dialog role – https://www.w3.org/TR/wai-aria-1.2/#dialog
  4. W3C, Understanding SC 4.1.2 Name, Role, Value – https://www.w3.org/WAI/WCAG22/Understanding/name-role-value
  5. W3C, Understanding SC 2.4.6 Headings and Labels – https://www.w3.org/WAI/WCAG22/Understanding/headings-and-labels

See what a scan finds on your site

One page in about thirty seconds, no email needed. The full report covers up to 100 pages and a keyboard journey.