Level
A
Since
WCAG 2.1
Entries
61 / 193
/ WCAG criterion

2.5.3 Label in Name

The words shown on a button or a field have to be part of the name that assistive technology hears, so that a person who says them aloud reaches the control they meant.

/ What it requires

A control has two names. One is the text people see on it, and the other is the accessible name that the browser hands to assistive technology. This criterion requires the second to contain the first whenever a control has a visible label made of text or of an image of text. People who work by voice say the words on the screen, such as "click Search", and speech software matches them against the accessible name. If the name says something else, the command does nothing.

The name may be longer than the label as long as the visible words are in it, and W3C recommends putting them at the start. Capital letters and punctuation do not have to match. A button that shows only an icon is out of scope, because it has no text label for the name to contain. The criterion lists no exceptions. A control fails when aria-label or aria-labelledby replaces the visible text with different wording, and that includes a synonym with the same meaning.

/ How pages fail it

  • A button reads "Search" on screen and carries aria-label="Find products".
  • A "Read more" link gets an aria-label that describes the article and leaves out the words "Read more".
  • A field is visibly labelled "Phone", and an aria-label of "Contact number" overrides that label.
  • A button built from an image of text shows "Send", and its alt text says "Submit form".
  • An aria-labelledby attribute points at hidden text whose wording differs from the text shown on the control.

/ How to check it yourself

  1. Go through the page and note every control that shows text: buttons, links, tabs, and fields with a visible label.
  2. Search the page source for aria-label and aria-labelledby. These two attributes are where a name most often drifts away from the visible text.
  3. Inspect each of those controls in the browser developer tools and open the Accessibility pane. Compare the computed Name with the words on screen.
  4. Turn on the voice control that comes with the operating system and say "click" followed by the visible words. A control that does not react needs a closer look.

/ How to fix it

  • Remove the aria-label and let the text inside the button or the a element serve as the name.
  • Where a longer name is needed, start it with the visible words, for example aria-label="Read more about the annual report" on a link that shows "Read more".
  • Alternatively keep the name equal to the visible text and attach the extra detail with aria-describedby, which adds a description without changing the name.
  • For an image of text, set the alt attribute to the words that appear in the image.
  • Name a field with a label element tied to it through the for attribute, and do not override that label with aria-label.

/ What our scanner checks

Our check, label-in-name, runs in the rendered page on controls the keyboard can reach. Where the accessible name comes from aria-label or aria-labelledby, it compares the name with the text shown on the control itself, ignoring case and punctuation, and reports a name that lacks it. It cannot read text inside an image or compare a field with a label printed beside it.

/ Who fails it, in our own measurements

Measured bodies failing this criterion, most instances first
BodySectorInstancesScore
San Franciscocity · US1928
Nürnbergcity · DE185
Szkoła Główna Handlowaeducation · PL1812
Bremencity · DE175
Gliwicecity · PL1713
Politechnika Łódzkaeducation · PL175
Poznańcity · PL171
Deutsche Bahntransport · DE96
Baltimorecity · US87
Elblągcity · PL720
Leipzigcity · DE722
PKP Intercitytransport · PL62
Gorzów Wielkopolskicity · PL56
Policjagovernment · PL512
Tychycity · PL520
Warszawski Uniwersytet Medycznyeducation · PL513
Bostoncity · US46
Hamburgcity · DE422
Uniwersytet Mikołaja Kopernikaeducation · PL47
Houstoncity · US37
LA Metrotransport · US317
Las Vegascity · US38
Muzeum Narodowe w Warszawieculture · PL311
Universität Heidelbergeducation · DE321
Warszawacity · PL320
Amtraktransport · US21
Narodowy Instytut Dziedzictwaculture · PL26
Philadelphiacity · US28
State of Georgiagovernment · US256
Uniwersytet Ekonomiczny w Krakowieeducation · PL215
Uniwersytet Łódzkieducation · PL29
Austincity · US113
Biblioteka Narodowaculture · PL117
Bundesagentur für Arbeitgovernment · DE116
Bundesministerium für Bildung und Forschunggovernment · DE18
Bundestaggovernment · DE110
Cook Countygovernment · US111
Denvercity · US139
Deutsche Rentenversicherunggovernment · DE15
Gdańskcity · PL12
Hannovercity · DE110
Indianapoliscity · US118
King Countygovernment · US113
Komisja Nadzoru Finansowegogovernment · PL18
Library of Congressculture · US130
Ohio State Universityeducation · US16
Opolecity · PL18
Pacjent.gov.plhealth · PL19
Phoenixcity · US11
Prezydent RPgovernment · PL112
Płockcity · PL152
Robert Koch-Instituthealth · DE110
Rzecznik Praw Obywatelskichgovernment · PL142
Social Security Administrationgovernment · US1-
Stuttgartcity · DE16
Travis Countygovernment · US137
Universität Hamburgeducation · DE137
Uniwersytet Śląskieducation · PL18
Veterans Affairsgovernment · US133
Zakład Ubezpieczeń Społecznychgovernment · PL127
Zielona Góracity · PL17

One page per body, measured by automated checks on a weekly schedule. Any body that has fixed something since the last sweep will show it at the next one, and every entity page carries a right of reply.

/ Questions about this criterion

What is the difference between a visible label and an accessible name?

The label is what a person sees on or beside the control: text or an image of text. The accessible name is what the browser reports to assistive technology, computed from the content of the element, a label element, alt text, aria-label or aria-labelledby. Usually the two are identical. They part ways when an ARIA attribute overrides the visible text.

Does the accessible name have to match the visible text exactly?

No. The name has to contain the visible text, and it may add words. W3C advises putting the visible words first, because some speech software matches from the start of the name. Differences in capital letters and punctuation do not count. A name that swaps a visible word for a synonym, or drops one, fails the criterion.

Does Label in Name apply to icon buttons?

Only when the control shows text. A button with nothing but a magnifying glass has no visible label, so there is nothing for the name to contain and this criterion does not apply. The button still needs an accessible name under 4.1.2 Name, Role, Value. Once text appears next to the icon, that text has to be in the name.