Skip to content

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”.

SC 4.1.2ASC 1.1.1A Markdown for agents
Broken Announced as “button”.
Fixed Says what it does.
The same control broken and fixed.
01

The problem

Screen reader and voice control users can't tell what the header's buttons do.

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?

Fern & Fold

Screen reader says: (Tab to a button)

A recreated demo. The broken version is intentionally inaccessible.

03

The fix

Give each icon button a name in words: hidden text, aria-label, or a visible label.

  1. 1Every icon button gets a name in words, whether hidden text, aria-label or a visible label.
  2. 2Hide the icon itself with aria-hidden="true".
  3. 3Name the action or destination, not the picture, and read a count only once.
Before Icons 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>
After

Visually hidden text inside the button

html

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

css

.visually-hidden {  position: absolute;  width: 1px;  height: 1px;  overflow: hidden;  clip-path: inset(50%);  white-space: nowrap;}

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. 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