WCAG 2.5.3: Label in Name
WCAG 2.5.3: Label in Name – Enhancing Predictability for All Users
WCAG 2.5.3, also known as “Label in Name,” is a crucial success criterion introduced in WCAG 2.1. It mandates that for user interface components with visible labels, the accessible name of that component must include the visible text. This seemingly simple rule has a profound impact on usability and accessibility, particularly for users of assistive technologies like screen readers and speech input software.
Introduction to Label in Name
At its core, WCAG 2.5.3 ensures consistency between what a user sees on the screen and what assistive technologies convey about an interactive element. Imagine a button with the visible text “Submit.” A screen reader user should hear “Submit” when they encounter it, and a speech input user should be able to activate it by saying “Submit.” The “Label in Name” criterion formalizes this expectation, requiring that if a component has a visible textual label, that exact text (or an image of text’s alternative text) must be part of its programmatic accessible name.
Why is Label in Name Important?
Compliance with WCAG 2.5.3 significantly improves the user experience for several groups:
Understanding the Success Criterion 2.5.3
The official wording of WCAG 2.5.3 is:
2.5.3 Label in Name (Level A): For user interface components with labels that include text or images of text, that text or text alternative is included in the accessible name.
Key aspects to note:
Exceptions:
There are two specific exceptions where this criterion does not apply:
Practical Guidelines for Compliance
Achieving compliance with WCAG 2.5.3 often involves careful construction of accessible names. Here’s how to ensure your components meet the criterion:
Examples of Correct and Incorrect Implementations
Correct Implementations
1. Simple Button with Text
Accessible Name: “Submit Form” (Matches visible label “Submit Form”)
2. Input Field with Associated Label
Accessible Name: “Email Address” (Matches visible label “Email Address”)
3. Button with Icon and Visible Text
Accessible Name: “Save” (Includes visible label “Save”)
4. Button with aria-label that includes visible text
Accessible Name: “Close this popup” (Includes visible label “Close”)
5. Icon-Only Button (Exception: No visible text label)
(Assume the following CSS defines a .sr-only class to visually hide text off-screen)
Accessible Name: “Menu”. (This component has no visible text label. The text “Menu” is visually hidden but programmatically available, satisfying the exception. The accessible name is “Menu”.)
Alternative Correct 5 (Icon-Only Button with aria-label – Exception):
Accessible Name: “Menu”. (This is an icon-only button with no visible text. The accessible name is provided directly by aria-label. This also falls under the exception as there is no visible text to include.)
Incorrect Implementations
1. Button with Mismatched aria-label
Visible label: “Log In”Accessible Name: “Go to Login Page”The visible text “Log In” is not included in the accessible name. This fails WCAG 2.5.3.
2. Input Field with Overriding aria-label
Visible label: “Username:”Accessible Name: “Enter your account ID”The visible label “Username:” is not included in the accessible name. This fails WCAG 2.5.3.
3. Link with Mismatched Title Attribute (if title is used to compute name)
Visible label: “More info”Accessible Name: “Read the full article” (from title attribute, if it overrides the link text)The visible text “More info” is not included in the accessible name. Note: While title is often ignored by screen readers in favor of explicit accessible names from element content or ARIA attributes, if a user agent *does* use title to form the accessible name, this would be an issue.
Best Practices and Common Pitfalls
Conclusion
WCAG 2.5.3 “Label in Name” is a fundamental criterion for creating accessible and usable web interfaces. By ensuring that the visible text of a component is always included in its accessible name, we empower users of screen readers and speech input software to interact with web content more efficiently and with less cognitive effort. Adhering to this principle of consistency and predictability fosters a more inclusive digital environment for everyone.
Related posts
- WCAG 5.2.3: Complete processes
- WCAG 5.2.4: Only Accessibility-Supported Ways of Using Technologies
- WCAG 5.2.5: Non-Interference
- WCAG 5.3.1: Required elements of the conformity declaration
- WCAG 5.3.2: Optional Components of a Conformance Claim
Still looking for answers?
Ask our experts using online chat