Icon-only buttons (add an accessible name)

A short, practical UI accessibility note for games and web UIs. No tracking.

Try the micro-demo: icon-only-button-demo.html

It compares icon-only toolbar buttons with no accessible name (BEFORE) vs labeled with aria-label (AFTER).

What goes wrong

If a button only shows an icon (gear, magnifying glass, X), many people can still use it visually. But for screen reader users, the button needs a name so the intent can be announced.

What to do instead

Minimal sketch (aria-label):

<button type="button" aria-label="Settings">
  <svg aria-hidden="true" ...>...</svg>
</button>

Alternative (hidden text):

<button type="button">
  <span class="sr-only">Settings</span>
  <svg aria-hidden="true" ...>...</svg>
</button>

Either pattern gives assistive tech something meaningful to announce.