Level AOperableNew in 2.1
2.5.3

Label in Name

A control's coded name must include its visible text, so voice-control users can say what they see.

In plain English

Voice-control users operate your site by speaking the labels they see: “click Add to cart”, “tap Search”. That only works if the control’s coded name actually contains those visible words. The trap is a well-meaning aria-label that replaces the visible text with something different, the button says “Search” but its accessible name is “Submit”, so saying “click Search” does nothing.

The rule: the accessible name must include the visible label text.

Who this is for

  • Voice-control users, who say the visible label to activate a control.
  • Screen-reader users, who are confused when the announced name does not match what they see.

How to check and fix it yourself

For each labelled control, check that any aria-label contains the visible text (and ideally starts with it). The safest option is often no aria-label at all, letting the visible text be the name:

<!-- Good: visible text is the name -->
<button>Add to cart</button>

<!-- Bad: aria-label doesn't contain the visible label -->
<button aria-label="Purchase item">Add to cart</button>

Where we can help

Mismatched labels usually come from aria-labels added with good intentions. We compare the visible label and accessible name on your controls and flag any that break voice control. It sits on the common failures list.

How to meet it

Techniques the W3C accepts as sufficient (summarized). Follow a link for the full method.

Common mistakes

Patterns the W3C lists as failures of this criterion. Avoid these.

Frequently asked questions

What does label in name require?+

Success Criterion 2.5.3 (Level A, added in WCAG 2.1) says that for controls with a visible text label, the accessible name (what assistive tech reads) must contain that visible text. Ideally the visible text comes first in the name.

Why does this matter for voice control?+

Voice-control users operate a control by saying its label, for example 'click Add to cart'. That only works if the button's coded name actually contains the words 'Add to cart'. If the visible label says 'Add to cart' but the aria-label says 'Purchase', the voice command fails.

What commonly breaks it?+

An aria-label that rewrites the visible text (button shows 'Search', aria-label says 'Submit form'), or a visible label with extra words the accessible name drops. Keep the accessible name in sync with, and containing, the visible label.

Reference

This is a plain-language explainer. The authoritative source is the W3C Web Content Accessibility Guidelines (WCAG) 2.2.

WCAG 2.2 © W3C. Excerpts are paraphrased; see the linked documents for the normative text.

Not sure if your store passes 2.5.3?

A human auditor checks this and every other criterion against your live store, and documents the result.

Book an audit