Barrierepruefung.de Web Accessibility Checker

WCAG 2.5.3 Label in Name: explained simply

If a control has a label that includes text or an image of text, its name in the code must contain the text people see. That lets them address it by voice. Putting that text at the start of the name is a best practice, not a requirement.

Last reviewed: Sources

What does the criterion require?

Controls often have two designations: the visible label, such as "Search" on a button, and the name in the code. This accessible name is what assistive technology such as screen readers and speech input receives. If the label includes text or an image of text, the name must contain the text that is presented visually.

People who operate a site by voice say the label they see, such as "click Search". If it does not appear in the name, the command fails. A name that differs can also act as a hidden command that gets activated by accident. Sighted people who have the page read to them are better off when they hear what they see. For people in either group who also have cognitive challenges, every mismatch is an extra load.

"Contains" means the name may be longer than the label. "Read more: new opening hours" matches the label "Read more". A note in the standard recommends putting the visible text at the start of the name, but does not require it. The text must occur in its entirety (G208) and in one piece (F96).

Where a component has no visible text label, the criterion does not apply to it. That a control has a name at all is required by 4.1.2 Name, Role, Value.

Which text counts?

The Understanding document advises treating only the text next to the component as its label: inside a button, to the left of or above a text field, to the right of a checkbox. Headings, instructions and the label of a group of fields should normally not be considered.

  • Placeholder text in a field may be a candidate if no other text is nearby. It is still not considered an appropriate way to label a field.
  • Characters used as symbols are not visible label text in this sense. If a button shows "B" for bold or ">" for next, the name should state the function. Formulas are different: they belong in the name as they are.
  • Capitalisation and punctuation are not relevant when evaluating the criterion. "Next" matches "Next…".
  • Text in parentheses may be left out of the name, for example "(required)". Where it matters, it has to be provided in the code in some other way; that is required by 1.3.1 Info and Relationships.

Common failures

  • An aria-label replaces the text. The button reads "Go", but its aria-label says "Find in this site". The attribute takes precedence, and the visible text does not occur in the name (F96).
  • Hidden text in the middle of the label. The link reads "Download brochure", but invisible text turns the name into "Download wall paint brochure". All the words are there, only not in one piece (F96).
  • A reference to other text. Through aria-labelledby a button takes its name from a hidden element that does not contain the visible label (F96).
  • No name at all. "Enter name" stands next to the field, but the text is not associated with it and no other name is provided. That also fails 1.3.1 and 4.1.2 (F111).

The simplest approach is to let the visible label itself supply the name: the text of a link or button, or the associated label element for form fields (G211).

Checked automatically and checked by you

What the automated check detects

The automated check does not measure this criterion. It is covered by a question in the manual checks.

What you check yourself

You answer this question in the manual checks of your scan.

Does the accessible name contain the visible text of the element?

  1. On several pages of different kinds, look for controls whose visible label includes text, including text in an image: links, buttons, tabs, and form fields with the text immediately beside or above them. Only the text directly at the control counts as its label, not a heading or a hint nearby. Controls that show only an icon do not fall under this question, nor do characters used as a symbol, such as ">" for "Next" or "B" for bold.
  2. Right-click such a control, choose "Inspect" (in some browsers "Inspect Element") and open the "Accessibility" view in the developer tools: it shows the name passed to assistive technology. A free screen reader (NVDA on Windows, VoiceOver on Mac) announces the same name when you reach the control with the Tab key. If you can carry out neither of the two tests, choose "I cannot judge this".
  3. The requirement is met if the name contains the visible text: the names "Search" and "Search for a term" both fit the label "Search". Capitalisation and punctuation do not matter; "Next…" and "next" count as the same. It is a defect if the visible text is missing from the name, as with the label "Learn more" and the name "Tariff details", or if a control with visible text has no name at all.

Classification

Level
A
Introduced in
WCAG 2.1
W3C explanation
Understanding 2.5.3