Skip to content
easeweb
Search topics

Icon-only buttons with no accessible name

The header's search, basket and menu buttons are drawn with SVG icons and contain no words, so each is announced only as "button".

WCAG 2.2
SC 4.1.2ASC 1.1.1A
Required by
Section 508 · EN 301 549 (EU)
Broken <button><svg>…</svg></button>
The accessibility problem illustrated: No vision:Button for what?
01

The problem

The header's buttons say what they do only in pictures, so screen reader and voice control users can't tell them apart

02

Try it

Press Tab to move through the header buttons

The panel shows what a screen reader announces. Can you tell which button opens the menu?

Broken Can you fix this?

BrokenIcons with no words
Fern & Fold

A recreated demo. The broken version is intentionally inaccessible.

03

The fix

Give each icon button a name in words

Before
BrokenIcons with no words
<header class="site-header">  <a href="/" class="logo">Fern & Fold</a>  <button type="button" class="icon-button">    <svg class="icon">      <use href="#icon-search"></use>    </svg>  </button>  <button type="button" class="icon-button">    <svg class="icon">      <use href="#icon-bag"></use>    </svg>    <span class="badge">2</span>  </button>  <button type="button" class="icon-button">    <svg class="icon">      <use href="#icon-menu"></use>    </svg>  </button></header>
What is wrong3 points
  • The search and menu buttons are announced only as "button". The SVGs give them no text, so they have no name.
  • The basket is announced as "2, button", which doesn't say what it is. Its only text is the badge's "2".
  • No one can tell the three apart by ear, or say a name to press one with voice control: each is announced as a button and nothing more.
After

Visually hidden text inside the button

<header class="site-header">  <a href="/" class="logo">Fern & Fold</a>  <button type="button" class="icon-button">    <svg class="icon" aria-hidden="true">      <use href="#icon-search"></use>    </svg>    <span class="visually-hidden">Search</span>  </button>  <button type="button" class="icon-button">    <svg class="icon" aria-hidden="true">      <use href="#icon-bag"></use>    </svg>    <span class="badge" aria-hidden="true">2</span>    <span class="visually-hidden">Basket, 2 items</span>  </button>  <button type="button" class="icon-button">    <svg class="icon" aria-hidden="true">      <use href="#icon-menu"></use>    </svg>    <span class="visually-hidden">Menu</span>  </button></header>
How it is fixed4 steps
  1. Put each button's words in a span: "Search", "Basket, 2 items" and "Menu". They are real text in the page, so the buttons are announced as "Search, button", "Basket, 2 items, button" and "Menu, button", and browser translation translates them.
  2. Hide those spans from view with the visually-hidden class.
  3. Hide the icons with aria-hidden="true", so the words alone name the buttons.
  4. Hide the badge with aria-hidden="true" too. The hidden text already includes the count; without that, the count would be read twice.

This fixes the Before and passes 4.1.2 and 1.1.1.

Easily confused
04

Verify the fix

4 checks, no mouse.

Test with: Keyboard, Screen reader, Zoom, 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 after the shared icon-button component changes.

Limits

This is a starting pattern, not a guarantee for every application. The sprite ids and class names in the snippets are placeholders. Icon buttons added later by content editors or third-party widgets need the same check. Help text that points to an icon button by its look, such as "tap the magnifying glass", also needs the button's name: see instructions that rely on colour, shape or position. When a button shows words as well as an icon, its name must contain those words: see buttons and links named differently from their text. The minus and plus of a quantity stepper need names too, and a number that can be typed: see quantity steppers with unnamed buttons and no typing. The faces of a rating scale need their values as names, and the question tied to them: see smiley-face ratings announced only as "button". 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