On this page

Accessible Names

What a name is#

Without a name, a button can be announced as just “button.”

Common sources

  1. Element content (button text, link text)
  2. Associated <label> for inputs
  3. aria-labelledby referencing visible text
  4. aria-label when no suitable visible text exists

Name playground#

Interactive demo

Change the name source

Name source

Live preview

Name source
text content
Role
button
Name
"Save draft"
State
enabled
Markup
<button type="button">Save draft</button>

Preferred techniques#

Prefer visible labels. Use aria-label when there is no suitable visible text—not as a substitute for clear UI.

Test

Test
ActionExpect
Inspect nameName matches visible purpose
Icon-only buttonHas aria-label or visible text alternative
InputHas a programmatic label association