WCAG 2.5.3: Label in Name

Back to all WCAG criteria

OVERVIEW

Effort:

  • Complexity:Easy
  • Duration:Fast

Important for:

Content

What's it about?

If the visible text of a control, whether a link, button, or form field, is expanded or further described in its accessible name, the visible text must be fully included.

This is especially important for people who use voice control. They need to be able to refer to the element exactly as it is visually labeled for the interaction to work.

Illustration comparing incorrect and correct ARIA labels. At the top, the visible link text 'Learn more' is shown. Below, a wrong example shows an anchor tag using aria-label 'Interesting stuff about digital accessibility!'. Under that, a correct example shows an anchor tag using an aria-label that repeats the visible link text: 'Learn more about digital accessibility'

How to

Depending on your situation, you can implement one of the following options to meet the criterion. For a deeper dive, please refer to the linked WCAG techniques.

  • Visible text is part of the accessible name

    Sometimes you may want to make links or buttons clearer for screen reader users by extending the accessible name.

    Example: product cards with buttons labeled “View product.” A screen reader user can generate a list of all interactive elements. In that list, it would not be clear which product each button refers to if they all simply say “View product.”

    One solution: extend the accessible name using an aria-label without changing the visible text.
    <a aria-label=”View product E-Learning for Design”>View product</a>

    The screen reader will now read: “View product E-Learning for Design,” while the visible text remains “View product.”

    Important: The visible text must be fully included in the accessible name. Otherwise, people who use voice control cannot activate the button by its name. Voice control reacts to the accessible name, not the visual text.

  • Visible and accessible name are the same

    Recommendation!

    The simplest technique: make sure that the visible text and accessible name are always identical. In most cases, it is best to put the full text directly into the link:

    <a href=”…”>Read more about accessibility</a>

    This completely avoids the problem and also saves you maintenance effort in the future. In addition, it reduces potential errors and makes the link immediately understandable for all users.

    Notes

        • Hint: Hidden text

          Instead of extending the text with an aria-label, you can also hide parts of the text via CSS:

          <a href=”produkt.html”>Learn more <span class=”visually-hidden”>about the product E-Learning for Design</span></a>

          The class .visually-hidden hides the text visually. The code for it:

          .visually-hidden {
          position: absolute !important;
          inline-size: 1px !important;
          block-size: 1px !important;
          padding: 0;
          margin: -1px;
          overflow: hidden;
          clip-path: rect(0, 0, 0, 0);
          white-space: nowrap;
          border: 0;
          }

          This is better than using ARIA for the following reasons:

          • The text exists in the HTML and is captured by translation tools.

          • Repetitions (like “Learn more”) at the beginning of every aria-label are avoided.

          • Easier maintenance because all text is in one place (in the markup).

          Accessible development?

          Our workshop for developers!

          Learn everything you need to know in our workshop to build accessible websites!

          More about the workshop

          Learn accessibility with us?

          Looking to implement WCAG best practices in your design, development, or content workflow? Book a workshop for your team or contact us directly to learn more.

          Send us an email!