Ensure Buttons Have Discernible Text

Photo of Researcher
Yotam Flohr
Researcher
Blind Hearing
WCAG 2.1 Level A

Written and researched for humans by humans

Photo of Researcher
Yotam Flohr
Researcher
Photo of Expert
Ritvik Shrivastava
Expertly reviewed by
Comments: 0
Your entire domain
Get detailed instructions on how to resolve every accessibility issue on your website

WCAG states that buttons must have discernible text that clearly describes the destination, purpose, function, or action to users who rely on screen readers.

The input-button-name rule separates functionality from the button-name rule, ensuring that input buttons have clear text.

Why It Matters

Screen reader users are not able to understand the purpose of elements with role=”link”, role=”button”, or role=”menuitem” if they don’t have an accessible name.

Fixing the Issue

Ensure that all buttons have a clear accessible name. 

Good Code Example

The button-name rule has five markup patterns that pass test criteria:

Code example
<button id="text">Name</button><button id="al" aria-label="Name"></button><button id="alb" aria-labelledby="labeldiv"></button> <div id="labeldiv">Button label</div><button id="combo" aria-label="Aria Name">Name</button><button id="buttonTitle" title="Title"></button> Copy

Test Cases

The button-name rule has six markup patterns that fail testing criteria:

Code example
<button id="empty"></button><button id="val" value="Button Name"></button><button id="alempty" aria-label=""></button><button id="albmissing" aria-labelledby="nonexistent"></button><button id="albempty" aria-labelledby="emptydiv"></button> <div id="emptydiv"></div><button id="buttonvalue" value="foo" tabindex="-1"></button> Copy

Test Cases

For more examples, visit the following pages in the W3C’s GitHub’s ATC Rules library: