How to fix: buttons with no text
WCAG 2.2 success criterion 4.1.2 (level A)
Why it matters
Screen reader users hear "button" but not what it does.
How to fix
Put text inside the button, or add aria-label for icon-only buttons.
<button aria-label="Close menu"><svg aria-hidden="true">…</svg></button>
Test it yourself
- Tab to each button and listen with a screen reader: it should say what the button does.
- Check close (X), menu (hamburger) and search buttons first.
Common mistakes
- A close button containing only "×".
- Using a div with a click handler instead of a real button.
- aria-label text that does not match the visible text.
Check your own site
Find this and other problems on your website in 30 seconds, free.