Skip to content
easeweb
Search topics

Visible text that screen readers skip

A shop draws its Sold out badge inside the product photo's link, which is hidden from screen readers as a duplicate, so a screen reader never says which mug is sold out.

WCAG 2.2
SC 1.3.1A
Required by
Section 508 · EN 301 549 (EU)
Broken <a class="photo" href="/mugs/glazed" aria-hidden="true" tabindex="-1">
The accessibility problem illustrated: No vision:Can I buy this one?
01

The problem

Screen reader users can't tell which product is sold out, and find out only when they open it.

02

Try it

Compare which mug the screen shows as sold out with what a screen reader reads for each card.

The reading below is worked out from the cards as they are built: what aria-hidden takes out is left out. Then try each fix.

Broken Can you fix this?

BrokenThe badge inside the hidden photo link

Reading the cards from the top, a screen reader says:

A recreated demo. The broken version is intentionally inaccessible.

03

The fix

Give each status in words that the screen and the screen reader share, and hide what doesn't apply from everyone.

  1. 1Never put words people need inside an element with aria-hidden, unless the same words are read beside it.
  2. 2Hide what doesn't apply from everyone, with hidden or display: none, not with opacity or a position off screen.
  3. 3Read the page with a screen reader and compare it with the screen, card by card.
Before The badge inside the hidden photo link
<ul class="products">  …  <li class="card">    <a class="photo" href="/mugs/glazed" aria-hidden="true" tabindex="-1">      <img src="/img/glazed-mug.jpg" alt="">      <span class="badge">Sold out</span>    </a>    <a href="/mugs/glazed">      Glazed mug    </a>    <p class="price">£22</p>  </li>  <li class="card">    <a class="photo" href="/mugs/tall" aria-hidden="true" tabindex="-1">      <img src="/img/tall-mug.jpg" alt="">    </a>    <a href="/mugs/tall">Tall mug</a>    <p class="price">£20</p>  </li></ul>
After

The badge outside the photo, only on the cards that are sold out

<ul class="products">  …  <li class="card">    <a class="photo" href="/mugs/glazed" aria-hidden="true" tabindex="-1">      <img src="/img/glazed-mug.jpg" alt="">    </a>    <span class="badge">Sold out</span>    <a href="/mugs/glazed">      Glazed mug    </a>    <p class="price">£22</p>  </li>  <li class="card">    <a class="photo" href="/mugs/tall" aria-hidden="true" tabindex="-1">      <img src="/img/tall-mug.jpg" alt="">    </a>    <a href="/mugs/tall">Tall mug</a>    <p class="price">£20</p>  </li></ul>

Fixing this with an AI coding assistant? Get this guide as Markdown, or get every guide in your coding agent.

04

Verify the fix

5 checks, no mouse.

Test with: Screen reader

0 of 5 checked

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

Limits

This covers words that are shown but not read, or read but not shown. Focusable content under aria-hidden is covered in aria-hidden content that keyboard focus still reaches, and decorative images in decorative images read out as file names or repeated text. Whether a hidden word is needed, or a hidden phrase is meant for screen readers, is a judgement a person has to make, page by page. Screen readers and braille displays differ in how they read cards and links: test with the ones your users have.

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.

Keep this fixed as your code changes.

Turn guides like this into rules your coding agents and CI follow, then have the result retested with a keyboard and screen readers.

How retests work