Rule

Button names

Buttons must have an accessible name.

Rule
button-name
WCAG 2.2
4.1.2 Name, Role, Value (opens in a new tab) (Level A)
Severity
Critical

What it checks

The rule looks at every element exposed as a button: <button>, inputs of type button, submit and reset, and anything with role="button". It fails one with no accessible name, from its text, an aria-label, an aria-labelledby or similar, because a screen reader then announces only "button". An icon-only button with no label is the usual case.

A <button> given another role, such as role="tab", is judged by the rule for that role instead.

Example

Fails

<button type="button"><span class="icon-search"></span></button>

Passes

<button type="button" aria-label="Search"><span class="icon-search"></span></button>

The engine is tested against both examples.

How to fix it

Give the button visible text. For an icon-only button, add an aria-label that says what it does, such as aria-label="Search".

Check your own pages

This rule runs in every pour audit: the browser extension, the bookmarklet, the command line and the editor. Get pour, free.