Why this matters
Screen reader users hear 'button' with no context about what it does. This affects navigation menus, close buttons, social media buttons, and any icon-based UI. It is a Level A failure — the most serious category.
Code examples
✗ Incorrect — fails WCAG
<button><i class="fas fa-times"></i></button> <button class="menu-toggle"></button> <button><img src="search.png"></button>
✓ Correct — passes WCAG
<button aria-label="Close dialog"> <i class="fas fa-times" aria-hidden="true"></i> </button> <button class="menu-toggle" aria-label="Open navigation menu" aria-expanded="false"> </button> <button> <img src="search.png" alt="Search"> </button>
How to fix it — step by step
- 1Add aria-label='description' to any button that has no visible text
- 2Add aria-hidden='true' to decorative icons inside buttons
- 3For toggle buttons (menus, accordions), add aria-expanded='true' or 'false'
- 4Never use a <div> or <span> as a button — use real <button> elements
- 5Real <button> elements are keyboard focusable by default — divs are not
- 6For buttons with both icon and text, the text alone is sufficient — no aria-label needed
Reference: WCAG 2.2 Success Criterion 4.1.2 (Level A)
Test it for free
Use WebPossum to automatically detect this violation and every other WCAG 2.2 issue on your site. Free, instant, no signup required.