Skip to main content
WCAGrules
Quick navigation

Match accessible names to visible labels exactly

G211 is the strict version of matching a control's name to what the reader sees. Same words, same order. In practice that usually means writing no ARIA at all and letting the visible text become the name. W3C's test is a little looser than that sounds, permitting case, punctuation and text in parentheses to be disregarded. Which text counts as the label is the question reviewers actually have to settle, and W3C answers it. Only the string adjacent to or close to the input counts. A group label such as a fieldset legend means something different, both in the markup and under this rule, so it is not the label being matched. This is a sufficient technique for 2.5.3 Label in Name at Level A. W3C prefers native elements and semantics for the same reason, because they produce an exact match without anybody maintaining one.

How we find it in an audit

Our reviewers read each control's accessible name against the visible text, using an inspector. Then we speak the visible words as voice commands. Where several pieces of text sit near a control, we identify the nearest one as the label rather than treating a section heading or a legend as the thing that has to match.

How affected users experience it

An accessible name lifted from a developer's variable name, such as addItemAction, is a name no reader will ever guess. Voice control users say 'Add to cart' and nothing responds. Screen reader users hear a name that does not match the page they are looking at, which is disorienting even when they work out what it means. Deleting the attribute usually fixes both.

Passes vs. fails

Passes: targets big enough to hit. Fails: tiny, touching controls.

Passes

<button>Add to cart</button>. The visible text is the accessible name because nothing overrides it.

Fails

<button aria-label="addItemAction">Add to cart</button>. Voice commands fail and support calls turn into guesswork.

How this gets tested

The W3C publishes test rules that define what a checker looks for here.

Other ways to satisfy this rule

5 guides on this site are filed under 2.5.3 Label in Name. W3C lists this one as sufficient for that rule on its own. Implement it correctly, in a way your readers' software actually supports, and the rule is met.

This guide is our interpretation of W3C technique G211: Matching the accessible name to the visible label. W3C publishes its techniques as guidance rather than as the standard, and says so on every one of them. The success criterion is what conformance is measured against, and a technique is one documented way to meet it.

Go somewhere useful

Find tools, resources and your workspace.

29 destinations