Accessibility guides

How to fix "Buttons must have discernible text"

A button that shows only an icon (a hamburger menu, an X to close, a magnifying glass) is announced as "button" with no hint of what it does. This fails WCAG 4.1.2. Voice-control users are affected too: they cannot say "click close" if nothing is named "close".

The fix

<button type="button" aria-label="Close cart">
  <svg aria-hidden="true" focusable="false">...</svg>
</button>

Name the action, and be specific when a page has several similar buttons: "Close cart", "Close menu", "Remove Sea Salt candle from cart".

Buttons that change state

For a menu toggle, keep the name stable and expose the state separately, so the screen reader announces "Menu, collapsed" and then "Menu, expanded".

<button type="button" aria-label="Menu" aria-expanded="false" aria-controls="site-nav">

Watch for these

Check your own site

Our free scanner loads your pages in a real browser and lists every failure like this one that automated testing can detect. Scan a site.