Skip to content
easeweb
Search topics

SVG icons with no name, or read out 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
The status is not read.
The accessibility problem illustrated.
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?

icon-package Your orders

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

A screen reader reads:

  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

Name every SVG that carries meaning, and hide every SVG that doesn't with aria-hidden="true".

  1. 1Every inline SVG is named or hidden, never left in between.
  2. 2Name the icon's meaning here, as an aria-label or as visible text beside a hidden icon, not its shape.
  3. 3Hide decorative icons with aria-hidden="true", and remove the title they came with.

Not enough on its own. Meets 1.1.1 for screen reader users, but the status is still shown only as an icon, so sighted people who don't know what a truck or an exclamation mark stands for still have to guess.

Before Status 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>
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>

Fixing this with an AI coding assistant? Get this guide as Markdown

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.

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