Skip to content
WCAG 4.1.2 Name, Role, Value

How to fix: Buttons must have an accessible name

Every button needs a discernible name. An icon-only button with no label is announced as “button”, so nobody using a screen reader knows what it does.

The fix

Ensure every button has a discernible label: visible text, aria-label, or aria-labelledby.

Who this affects

An icon button with no name reaches a screen reader as "button" and nothing else, so someone using JAWS on an admin table hears the same word for delete, duplicate and export. Voice control users cannot address the control by name at all, since macOS Voice Control and Dragon both target a control by its accessible name. That turns a destructive action into a guess about which position in the row does what.

Before and after

Fails
<button><svg>…</svg></button>
Passes
<button aria-label="Close dialog"><svg aria-hidden="true">…</svg></button>

Where this usually comes from

  • An icon-only button whose only child is an inline SVG marked aria-hidden="true".
  • A design-system Button component with an optional label prop, so consumers pass an icon and skip the label.
  • A <button> wrapping only an <img> whose alt is empty or missing, so nothing inside the button contributes a name.
  • Button text that only arrives after hydration, leaving the server-rendered markup empty at scan time.
  • aria-labelledby referencing an id in a different shadow root, or one removed by a virtualised list.

Checking it yourself

Select the button in Chrome DevTools, open the Accessibility pane and read the computed Name; an empty value is the violation. Tab to the control with NVDA or VoiceOver running and listen for what comes after the role, since an unnamed control gives you "button" and stops. Reading the markup on its own is not enough, because aria-label and aria-labelledby both count and visible text hidden with display:none does not.

A scanner finds this one automatically. What it cannot judge, and how the score is built, is on how we test.

Related fixes

Check your site for this issue

Scan any page free against WCAG 2.2 AA and get every automatically detected issue with its fix.

Scanning a page needs no account. The checks run on axe-core.

← All fix guides