Skip to content

ACT-001b Give every button an accessible name that says what it does and contains its visible text

Level
Rule
Verdict
Requirement
Status
decided, version 1.0.1

Rule

Give a button that shows no text an accessible name that says what pressing it does, not what its icon pictures. Give a button that shows text an accessible name that contains the visible words in the same order; case and punctuation may differ. Starting the name with the visible text is our advice, not a requirement.

Examples

Live examples built with Justified's components. Try them with the mouse, the keyboard or a screen reader.

Do: Named by what it does, visible words kept

Attachments

  • contract.pdf, 240 KB

  • floor-plan.png could not be uploaded. The connection dropped. Try again.

The bin buttons show no text, so their names say what they do and to which file. Try again keeps its words at the start of its name. Tab through the buttons and read the name under the list. Press Try again: the file uploads and focus moves to its bin. Remove a file and Undo puts it back.

Don't: Named after the picture, visible words missing

Attachments

  • contract.pdf, 240 KB

  • floor-plan.png could not be uploaded. The connection dropped. Try again.

The bins are named after their picture, so a screen reader says “Bin” and not what pressing it does. Tab to Try again: its name is “Resend file”, so a speech command for the words on screen finds nothing.

Why

A screen reader reads the name, not the picture. An icon of a bin, a gear or three dots means nothing unless the name says what happens: "Remove attachment" tells the person what they are about to do, while "Bin" only describes a drawing. People who use speech control do the opposite. They say the word they see on the screen, and the button only answers if its name contains that word. A name that differs from the visible text breaks this, which often happens when an aria-label replaces the text on screen.

These are requirements. WCAG 2.2, 1.1.1 Non-text Content asks that a control shown without text gets a name telling what it is for. 2.5.3 Label in Name asks that a control whose label includes text has that text in its name. Case and most punctuation do not count. 4.1.2 Name, Role, Value asks that every button has a name that software can read. Putting the visible text first is advice: it makes speech commands and the screen reader's version match from the first word.

Do

  • An icon button with a bin on an attachment row has the name "Remove attachment".
  • An icon button with three dots on a project card has the name "More actions for Spring Fair".
  • A button that shows Archive on each row of an invoice list has the name "Archive Invoice 1042". The visible word comes first, and the name adds the row.
  • A button that shows Try again after a failed upload keeps that text as its name, or starts with it: "Try again, upload contract.pdf".
  • A button that shows the letters A+ to make the text larger has the name "Larger text", because the letters stand for a function, not a word.
  • In shadcn, give an icon-only Button an aria-label, or put the name in a visually hidden span inside it. Leave the visible text as the name for a button that has one.

Don't

  • Name an icon button after its picture, such as "Gear" for a button that opens account settings.
  • Leave an icon button with no name, so a screen reader says only "button".
  • Give a button that shows Continue the aria-label "Go to payment", so the word on screen is not in the name and a speech command for it does nothing.
  • Count on a tooltip to give the name. A tooltip may help sighted users, but whether it is read as the name depends on how it is built. Set the name on the button itself.
  • Add the role to the name, such as "Remove attachment button". The screen reader already says it is a button.

Exceptions

  • Text used as a symbol. When the visible characters stand for a function rather than spell a word, such as A+ or an @ that is named "Mention a colleague", name the function. 2.5.3 does not treat such text as a label.
  • Decorative icons beside text. An icon next to a visible word adds nothing to the name. Hide it from assistive technology, and let the word be the name.

Verdict

Requirement. Only the judges decide; the expert witnesses are shown but do not vote. How verdicts work

Stances on ACT-001b
SourceRoleStancePage
WCAG 2.2LawRequires1.1.1 Non-text Content
WCAG 2.2LawRequires2.5.3 Label in Name
WCAG 2.2LawRequires4.1.2 Name, Role, Value
Material DesignJudge SupportsAccessibility designing: elements
Buttons: accessibility
Apple Human Interface GuidelinesJudge No position
Carbon Design SystemJudge No position
GOV.UK Design SystemExpert witness No position
Nielsen Norman GroupExpert witness No position

Each stance links to the page it rests on, read on the date in the source register. This page never repeats what a source says; read the source itself.

History

  • Version 1.0.1, : Examples in English.
  • Version 1.0.0, : First version.

Last checked against the other rules for conflicts on .

More in Actions: 11 rules and 4 guidelines · All rules