Skip to main content
Brand and assets
BuildMonitor and contribute
/
Brand and assets
  • Foundations
    • The brand
    • Logo
    • Colors
    • Typography
    • Styles
    • Shadows & radii
    • Spacing & grid
    • Gradients
    • Styling & the sx prop
    • Color tokens
    • More
    • Accessibility
      • Accessible names
      • Headings
      • Images
      • Accessible colors
      • Anchors
      • HTML semantics
      • DOM order
      • Accessible alternatives
      • Debug with the accessibility tree
      • Engineer setup
  • Assets
  • AI references
  • Foundations
  • Accessibility
  • Accessible names

Accessible names

What is an Accessible Name?​

An accessible name is a short, descriptive name given to HTML elements to communicate the purpose or content of the element to assistive technology users, such as screen readers. This name is not necessarily visible on the screen but is crucial for understanding the function of interactive elements like buttons, links, and form inputs.

Why Do Accessible Names Matter?​

Accessible names are crucial for enhancing usability by helping users with disabilities understand the purpose of elements without needing to see them. This is particularly important for screen reader users and those with cognitive disabilities. Additionally, well-defined accessible names contribute to better SEO as they reinforce the semantic meaning of the content, aiding search engines in understanding the page structure.

WCAG and RGAA Guidelines​

  • WCAG 2.1, 4.1.2: Name, Role, Value: For all user interface components, the name and role can be programmatically determined; states, properties, and values that can be set by the user can be programmatically set.
  • RGAA 4.1: Every interface component with an interactive role must have a name.

How to Choose a Good Accessible Name​

Descriptive and Concise: The name should clearly describe the purpose of the element. Avoid vague descriptions like "click here" or "button". Contextual Relevance: The name should make sense in the context of the surrounding content. Localization Considerations: Ensure the accessible name is localized appropriately for multilingual sites.

How is computed the accessible name?​

The computation of an accessible name in web content follows a specific sequence of steps to determine what text is presented to assistive technologies. This process is defined by the Accessible Rich Internet Applications (ARIA) specification and the HTML standards. Here’s a concise overview:

  • Use aria-labelledby: If this attribute is present, the accessible name is generated from the content of the elements referenced by the IDs in aria-labelledby.
  • Use aria-label: If aria-labelledby is not present or fails, aria-label is used if it exists.
  • Use <label> Element: For form elements, if a label is associated using the for attribute pointing to the ID of the input, the text within this label is used.
  • Use Native Techniques: If none of the above are present, native HTML attributes like alt for images, title attributes, or text content of elements like buttons or links are used. If multple are provided, they all are concatenated.
  • Use title Attribute: As a last resort, if no other labels are provided, the title attribute can be used. One difference with the title, is that it provides a visual tooltip in addition to the accessible name.

This sequence ensures that the most explicit descriptions provided by developers are prioritized, while still offering fallbacks to more implicit naming strategies.

Examples​

Good Accessible Names​

  • Buttons:
<button aria-label="Add to cart">+</button>

"Add to cart" clearly describes the button's function rather than just showing a plus symbol.

  • Links:
<a href="/contact" aria-label="Contact us">
Learn more
</a>

The aria-label "Contact us" provides clear context, which "Learn more" lacks.

  • Form Elements:
<label for="email">Email:</label>
<input type="email" id="email" name="email" />

The label "Email:" is directly associated with the input field, providing clear, accessible information.

Poor Accessible Names​

  • Buttons:
<button>Click here</button>

"Click here" does not describe the purpose or the action of the button.

  • Links:
<a href="/docs">Click here</a>

Similar to the button, "Click here" for a link does not provide any context about the destination or action.

  • Form Elements:
<input type="submit" value="Go" />

"Go" is too vague and does not describe what the form submission will do.

Edit this page
Previous
Introduction
Next
Headings
  • What is an Accessible Name?
  • Why Do Accessible Names Matter?
  • WCAG and RGAA Guidelines
  • How to Choose a Good Accessible Name
  • How is computed the accessible name?
  • Examples
    • Good Accessible Names
    • Poor Accessible Names