Skip to main content
Raasta
SeriousBest practicearia-dialog-name

Dialog has no accessible name

A dialog or alertdialog without a name is announced only as “dialog”, so people don’t know what has just opened. Point aria-labelledby at the dialog’s heading, or add an aria-label.

Who it hurts

Screen reader users, who hear the dialog open but not what it is about.

Cart drawers, newsletter pop-ups, cookie banners and country pickers often get a role but no name.

How to fix it

Pick your stack. Review every change before you ship it.

Before

<div role="dialog" aria-modal="true">
  <h2>Choose your country</h2>

After

<div role="dialog" aria-modal="true" aria-labelledby="country-title">
  <h2 id="country-title">Choose your country</h2>

Check it by hand too

Open each dialog with a screen reader on. You should hear its name as focus moves into it, such as “Choose your country, dialog”.

Automated checks find a large share of accessibility problems, but not all of them. Passing this check does not on its own make a page compliant.