Accessible Button Naming
Rule ID: button-name
Ruleset: axe-core 4.10
User Impact: Critical
Guidelines: WCAG 2.1 (A), WCAG 2.0 (A), WCAG 2.2 (A), Section 508, Trusted Tester, EN 301 549
How to Fix the Problem
To meet accessibility compliance, every <button>
element—or any element with role="button"
—must have an accessible, discernible name. This ensures that users relying on screen readers can understand the purpose or action of the button.
Use one of the following correct approaches:
-
Text Content:
The inner text is read by screen readers.
-
ARIA Label:
The
aria-label
provides an accessible name even if the button has no visible text. -
ARIA Labelledby:
The button references another element that contains the accessible name.
-
Combined Text and ARIA Label:
Screen readers will use the ARIA label in favor of the inner text.
-
Title Attribute (use with caution):
Although not a primary method, the
title
attribute can serve as a fallback accessible name. -
If the button is decorative and non-interactive:
Use:This removes it from the accessibility tree and tab order.
Avoid the following incorrect implementations:
-
Empty buttons:
-
Using only
value
attribute: -
Empty
aria-label
: -
aria-labelledby
pointing to a missing or empty element: -
Button with a value but no label and
tabindex="-1"
:
Why it Matters
Buttons without accessible names are functionally invisible to screen reader users. This means they can’t identify what action the button performs, which significantly hinders navigation and interaction.
Accessible button naming ensures users with visual disabilities can complete key tasks such as submitting forms, navigating modal dialogs, or triggering interactive elements. Without proper labels, the user experience becomes confusing and exclusionary, violating WCAG and other legal accessibility standards.
Rule Description
All <button>
elements and any element with role="button"
must include a discernible name that describes their function or purpose to users of assistive technologies.
This rule enforces the requirement that buttons must communicate their action clearly through accessible naming strategies like visible text or ARIA attributes.
The Algorithm (in simple terms)
-
Locate every button element on the page.
-
Check whether it has:
-
Visible text content, or
-
A non-empty
aria-label
, or -
An
aria-labelledby
attribute pointing to text content.
-
-
If none of these exist, the element fails the rule.