WCAG Encyclopedia

2.5.3 · OperableLevel A

Label in Name

A control’s accessible name must contain the text shown on it. Voice-control users say what they see — "click Send" — and if the accessible name is something else, nothing happens.

Principle
Operable
Guideline
2.5
Level
A
In WCAG since
2.1
Number
2.5.3

Broken, then fixed

The same interface twice: first with the mistake, then with the smallest change that fixes it.

Broken: The visible text and the accessible name disagree.
Sendaria-label="Submit form"

"Click Send" matches nothing. The label was probably added to be helpful, and it silently broke voice control for that button.

Fixed: The accessible name starts with the visible text.
Sendaria-label="Send message to support"

Extra context is fine as long as the visible text is in there, and best at the start. Usually the right fix is no aria-label at all — let the visible text be the name.

How to test

Check your own interface against 2.5.3, one step at a time.

  1. List every control on the page that shows text on screen: buttons, links, and form fields with a label beside them.
  2. Open the accessibility inspector in your browser (the Accessibility pane in Chrome or Edge DevTools, or the Accessibility tab in Firefox) and read the name of each one.
  3. Check that the name contains the visible text, in the same order. Differences of capital letters and punctuation do not matter.
  4. Where the name adds words, check that the visible text comes first: a button showing "Send" named "Send message" is better than one named "Message: send".
  5. Turn on speech recognition (Voice Control on a Mac, Voice access on Windows 11) and say "Click" followed by the visible text of each control. Check that it activates the right one.

Common questions

Must the accessible name match the visible label exactly?

No. The name has to contain the visible text, and it can add to it. Putting the visible words at the start of the name is the safe choice, because that is what voice control users will say.

Does 2.5.3 apply to an icon button with no visible text?

No. 2.5.3 applies only where there is visible text to match. An icon button still needs a name that says what it does, which 4.1.2 Name, Role, Value covers.

Does a close button shown as "X" need the name "X"?

No. A symbol is not treated as a text label, so name the button for what it does, such as "Close".

Try it yourself

A lab is a small working piece of interface that you change yourself. Read its steps, use the controls under it, and watch the verdict line at the bottom: it says whether the criterion passes or fails as you go. Reset puts it back.

Try it: say what you see

How to use this lab

  1. Goal. Make a button answer to the words written on it.
  2. The controls. The Visible text on the button field sets the words the button shows. The aria-label field sets a name that software uses instead; leave it empty for none. The Voice control log says what happens when you say “click” and the visible text, and the log beside it says what a screen reader hears.
  3. Try this. The lab starts with “Send” on the button and an aria-label of “Submit form”, which fails. Empty the aria-label field, or change it to “Send form”. Then change the visible text to words the aria-label doesn’t contain.
  4. What it means. 2.5.3 passes when the button’s name contains its visible words, in order. It fails when it doesn’t: someone using voice control says “click Send” and nothing happens. The verdict line under the lab says which.

Leave it empty for no aria-label.

Voice control

  1. You say “click Send”
  2. Nothing happens

Screen reader says

    2.5.3 fails

    Also in guideline 2.5

    Criteria in the same guideline often fail together.