Skip to content
easeweb
Search topics

Buttons and links named differently from their text

Each "Add to bag" button got an aria-label naming the product and saying "cart", so its name lacks the words on the button and voice control can't find it.

WCAG 2.2
SC 2.5.3A· new in 2.1
Required by
EN 301 549 (EU)
Broken aria-label="Add Linen tote to cart"
The accessibility problem illustrated: Motor:Why won't it click?
01

The problem

Voice control users can't press the shop's "Add to bag" buttons by saying what they see, and screen reader users hear other words than the ones on screen

02

Try it

Say “Click Add to bag” with the simulated voice control, then press Tab to reach each button

Voice control looks for a button whose name holds the words you said. Under the grid is what a screen reader hears.

Broken Can you fix this?

BrokenAn aria-label with other words
  • Linen tote

    $48

  • Enamel mug

    $18

Voice control (simulated):

A recreated demo. The broken version is intentionally inaccessible.

03

The fix

Start each button's name with the words it shows

Before
BrokenAn aria-label with other words
<ul class="products">  <li class="card">    <img src="linen-tote.jpg" alt="">    <h3>Linen tote</h3>    <p class="price">$48</p>    <button type="button" aria-label="Add Linen tote to cart">Add to bag</button>  </li>  …</ul>
What is wrong2 points
  • A screen reader announces words that aren't on the screen. The button shows "Add to bag", but its aria-label makes its name "Add Linen tote to cart".
  • Saying "click Add to bag" reaches nothing. The visible words aren't in the name, so voice control has nothing to match them against.
After

The button's own words, with the product as a description

<ul class="products">  <li class="card">    <img src="linen-tote.jpg" alt="">    <h3 id="product-linen-tote">Linen tote</h3>    <p class="price">$48</p>    <button type="button" aria-describedby="product-linen-tote">Add to bag</button>  </li>  …</ul>
How it is fixed2 steps
  1. Remove the aria-label. The button's text is its name again: "Add to bag".
  2. Give the heading an id, and point the button's aria-describedby at it. The heading becomes its description, which screen readers read after the name and role: "Add to bag, button, Linen tote".

This fixes the Before and passes 2.5.3. "Click Add to bag" now matches every card's button, and voice control numbers them so the person can say which one, as it does for any repeated label.

Easily confused
04

Verify the fix

4 checks, no mouse.

Test with: Speech input, Screen reader, Keyboard

0 of 4 checked

Record the OS, browser and assistive-technology versions, the build, the date, and the actual result of each step. Repeat after the shared button or product card component changes.

How screen readers handle aria-describedby

Limits

This is a starting pattern, not a guarantee for every application. Speech software differs in how it matches what is said, so test with the voice control your users have. Buttons that third-party widgets or content editors add need the same check. Whether a name that starts with the visible words also says enough about its product is a separate question, covered for links in "Read more" links that all say the same thing. Test the complete journey with your target assistive technology.

This is a recreated teaching example, not a finding about a named client. The code is a starting pattern: test it in your own product. No completed assistive-technology test is claimed here.

EaseWeb service

Fixed it? Keep it from coming back.

I turn guides like this one into rules your coding agents follow and checks your CI runs. Then I retest by hand with a keyboard and screen readers, periodically.

See the service