Ensure All Buttons Have Accessible Names
Learn how to ensure all buttons have descriptive, accessible names. Includes code examples.
What Is It?
A button's accessible name is the text announced by screen readers. Sources (in priority order): visible text content, aria-label, aria-labelledby, title attribute. At least one must exist.
Affected users: Screen reader users, users with motor disabilities, voice control users, users on mobile without seeing icons
Why It Matters
Buttons without names (icon-only buttons, buttons with no text) are announced as 'button' with no description. Users don't know what clicking does.
How to Detect This Issue
Test with screen reader. Navigate to all buttons and verify each has a meaningful name announced. Inspect element and check for text content, aria-label, or title.
Code Examples & Fixes
HTML / CSS
<button><svg>...</svg></button> <!-- icon-only, no name --><button aria-label="Close dialog"><svg aria-hidden="true">...</svg></button>Icon-only buttons need aria-label. aria-hidden on SVG prevents double announcement. Visible text is preferable: <button><i></i> Close</button>
React / Next.js
<button onClick={search}><SearchIcon /></button><button onClick={search} aria-label="Search articles"><SearchIcon aria-hidden="true" /> <span className="sr-only">Search</span></button>Option 1: aria-label="Search articles". Option 2: visible text in sr-only span. Option 3: visible text without span. Don't combine (redundancy).
WordPress
Sidebar widget with close button icon, no text or aria-labelClose button with visible text "Close" or aria-label="Close sidebar"WordPress: ensure buttons in widgets, menus, sidebars have accessible names via HTML or ARIA.
Shopify Liquid
Shopping cart icon button with no label<button aria-label="Shopping cart, 3 items"><CartIcon /></button>Shopify: icon buttons (cart, menu, search) need clear aria-labels. For cart, include item count.
Common Mistakes
Icon-only buttons without aria-label or visible text
aria-label that matches visible text exactly (redundant)
Forgetting that aria-label on parent button applies to button, not separate spans
Using title attribute alone for button names (not reliable for keyboard users)
Buttons with only placeholder text or invisible text
Frequently Asked Questions
What's the best way to name icon buttons?
Is title attribute enough for button names?
Can I use aria-label on <a> elements?
What if button text is too long visually?
Check your website for free
Get your ADA, WCAG, privacy & security score in 90 seconds.
Related guides
Add ARIA Labels to Custom Components
Learn how to use ARIA attributes to label custom components, buttons, and interactive elements. Includes code examples and best practices.
Make Link Purpose Clear
Learn how to write clear link text that describes the destination. Includes code examples and common mistakes.