aria-command-nameCustom button or menu item has no name
An element with role="button", role="link" or role="menuitem" but no text or label is announced only by its role, so people can’t tell what it does. Give it a name with text inside it or an aria-label, or use a real <button> or <a> with text.
Who it hurts
Screen reader users, and voice control users who need a name to say.
Icon-only controls built from <div>s and <span>s, such as close, share and quantity buttons, are the usual cases.
How to fix it
Pick your stack. Review every change before you ship it.
Before
<span role="button" tabindex="0" class="icon-close"></span>After
<button type="button" class="icon-close" aria-label="Close"></button>Check it by hand too
Tab to each custom control with a screen reader on. Each should be announced with a clear purpose, such as “Close, button”.
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.
WCAG reference
- 4.1.2 Name, Role, Value (Level A). Understanding 4.1.2