Skip to content
easeweb
Search topics

SVG icons with no name, or read when they should be silent

An order list shows each order's status only as an inline SVG with no name, while the heading's decorative icon has its file name read out from a title element.

WCAG 2.2
SC 1.1.1A
Required by
Section 508 · EN 301 549 (EU)
Broken role="img"
The accessibility problem illustrated: No vision:Is my order delivered?
01

The problem

Screen reader users can't tell whether an order was delivered, and hear icon file names instead

02

Try it

Compare what you see with what a screen reader reads

The panel shows what a screen reader reads, top to bottom. Can you tell which order arrived and which payment failed?

Broken Can you fix this?

BrokenStatus icons with no name, and a decorative icon with a title

icon-package Your orders

  • Order 1042 3 October
  • Order 1043 6 October
  • Order 1044 8 October

Screen reader says:

  1. icon-package Your orders, heading
  2. list, 3 items
  3. Order 1042, 3 October, image
  4. Order 1043, 6 October, image
  5. Order 1044, 8 October, image

A recreated demo. The broken version is intentionally inaccessible.

03

The fix

Say what each icon means, and hide the decorative ones

Before
BrokenStatus icons with no name, and a decorative icon with a title
<h2>  <svg viewBox="0 0 24 24"><title>icon-package</title>…</svg>  Your orders</h2><ul class="orders">  <li>    Order 1042 <span class="date">3 October</span>    <svg role="img" viewBox="0 0 24 24" class="ok">…</svg>  </li>  <li>    Order 1043 <span class="date">6 October</span>    <svg role="img" viewBox="0 0 24 24" class="info">…</svg>  </li>  <li>    Order 1044 <span class="date">8 October</span>    <svg role="img" viewBox="0 0 24 24" class="error">…</svg>  </li></ul>
What is wrong2 points
  • Screen reader users can't tell which order arrived. Each status icon is an image with no text alternative, so it is read as "image" or not at all.
  • The heading is read as "icon-package Your orders". The parcel icon adds nothing, but the title inside it becomes part of the heading's name.
After

Name each status icon

<h2>  <svg viewBox="0 0 24 24" aria-hidden="true">…</svg>  Your orders</h2><ul class="orders">  <li>    Order 1042 <span class="date">3 October</span>    <svg role="img" aria-label="Delivered" viewBox="0 0 24 24" class="ok">…</svg>  </li>  <li>    Order 1043 <span class="date">6 October</span>    <svg role="img" aria-label="On its way" viewBox="0 0 24 24" class="info">…</svg>  </li>  <li>    Order 1044 <span class="date">8 October</span>    <svg role="img" aria-label="Payment failed" viewBox="0 0 24 24" class="error">…</svg>  </li></ul>
How it is fixed2 steps
  1. Keep role="img" on each status icon, so it is exposed as one image, and add an aria-label that says what it means for this order. A screen reader reads "Order 1042, 3 October, Delivered, image".
  2. Take the title off the parcel icon and give it aria-hidden="true", so the heading is read as "Your orders".

This fixes the Before and passes 1.1.1. The page looks exactly as before, and that is its limit: the status reaches screen readers in words, but on screen it is still only an icon. Someone who doesn't know that the truck means "on its way", or who reads the red circle as an error with the site rather than with their payment, is left to guess. No A or AA criterion requires the words to be visible, but W3C's guidance on making content usable for people with cognitive disabilities asks for icons that users already know, placed next to the content they relate to.

Easily confused
04

Verify the fix

4 checks, no mouse.

Test with: Screen reader, Forced colors

0 of 4 checked

Record the OS, browser and assistive-technology versions, the build, the date, and the actual result of each step. Repeat whenever the icon set or the shared icon component changes.

Limits

This is a starting pattern, not a guarantee for every application. Paths, class names and the … in the SVGs are placeholders. Screen readers announce named SVGs in slightly different ways, and some still read an unnamed one, so test with the assistive technology your users have. Whether an icon is decorative depends on what the text around it already says, and only someone who knows the page can judge that. 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