Buttons and Links Missing Accessible Names
Buttons and links without accessible names are invisible to screen readers and keyboard navigation. This page explains the accessible name computation and how to resolve unnamed interactive elements.
Interactive elements require a computed accessible name so assistive technology can identify them. Browsers calculate this name from a defined sequence: text content, then aria-label, then aria-labelledby, then title attribute. When none of these sources produce a string, the element has no name. Screen readers announce it as an unlabeled button or link. Keyboard users encounter a focusable element with no indication of what it does. The two most common violations — button-name and link-name — share this root cause.
What's wrong
One or more buttons or links on the page have no accessible name. The browser's accessible name computation evaluated all available sources — text content, aria-label, aria-labelledby, and title — and produced an empty string. The element exists in the DOM and receives focus, but assistive technology cannot describe it. Screen readers announce 'button' or 'link' with no additional context.
Why it matters
An unnamed interactive element is functionally invisible to anyone not using a pointing device. Screen reader users hear 'button' with no label and must guess what the control does. Keyboard users tab to a focused element with no description. Voice control users cannot target the element by name. This affects WCAG 4.1.2 (Name, Role, Value), a Level A success criterion. Level A failures affect the widest population of users and represent the baseline expectation for interactive content.
How browsers compute an accessible name
The accessible name computation follows a defined priority order. The browser first checks aria-labelledby, which references other elements by ID and concatenates their text. If absent, it checks aria-label, a string attribute on the element itself. If neither attribute exists, the browser uses the element's text content — the flattened string of all descendant text nodes. If text content is empty (common with icon-only buttons), it falls back to the title attribute. When all sources are empty, the computed name is an empty string. The element is unnamed.
Patterns that produce unnamed elements
- Icon-only buttons: A <button> containing only an <svg> or <i> element with no text, aria-label, or sr-only span. This is the most frequent cause of button-name violations.
- Image links: An <a> wrapping an <img> where the image has no alt text and the link has no other text content.
- Empty links: An <a href> with no text content, often used for wrapping a clickable area around a block element.
- Generated controls: JavaScript-rendered buttons where the label depends on data that fails to load or arrives after the accessibility tree is built.
- CSS-hidden text: A button with text moved offscreen via CSS (e.g., text-indent: -9999px) that is removed from the accessibility tree by display:none or visibility:hidden on the text container.
The correct change
Every interactive element must resolve to a non-empty accessible name through at least one computation source. For icon-only buttons, add an aria-label attribute that describes the action: <button aria-label="Close dialog">. For image links, set meaningful alt text on the contained image. For empty links, add visually hidden text using a CSS class that keeps the text in the accessibility tree (position: absolute, clip, overflow: hidden) or add aria-label. The end state is that every button and link on the page announces its purpose when encountered by assistive technology.
Scope
This condition applies at the page level. Each page is evaluated independently for unnamed interactive elements. Buttons and links in shared templates, navigation, and footers propagate unnamed elements across every page that includes them. Fixing a shared component resolves the violation wherever it appears.
How to verify
- Validation confirms the condition is resolved:
- • Every <button> element has a non-empty computed accessible name
- • Every <a> element with href has a non-empty computed accessible name
- • Elements with role="button" or role="link" have a non-empty computed accessible name
- • Icon-only buttons include aria-label or visually hidden text
- • Image links have alt text on the contained image or aria-label on the link
- • Browser accessibility inspector shows a name for each interactive element
- • Screen reader announces each button and link with a descriptive label
Takeaway
- Interactive elements without accessible names cannot be identified by assistive technology
- The accessible name computation follows a strict priority: aria-labelledby → aria-label → text content → title
- Icon-only buttons are the most common source of this violation
- Fixing shared components eliminates the violation across all pages that use them