Align visible labels with accessible names
The accessible name of a control should contain its visible label text.
- Visible text should be part of the accessible name (ARIA label)
- Ensure speech-to-text users can trigger controls by their visible name
- Maintain consistency between what is seen and what is read by tech
Rule Details
For users of speech recognition software, the accessible name of a control must contain the text that is visible on the screen. WCAG 2.5.3 Label in Name (opens in new tab) exists specifically so voice users can speak the same words they see.
Code Examples
Correct Implementation
<!-- Visible text is part of the ARIA label -->
<button aria-label="Add item to shopping cart">Add item</button>
<!-- Preferred: Just use the visible text -->
<button>Add item</button>Incorrect Implementation
<!-- Mismatch: Voice user says "Submit", but computer expects "Send" -->
<button aria-label="Send feedback">Submit</button>Why It Matters
- Voice Control: Users of software like Dragon NaturallySpeaking or Apple Voice Control trigger actions by speaking the visible label. If the underlying code uses a completely different name, the command will fail.
- Consistency: Prevents confusion for screen reader users who might be collaborating with sighted users ("Click the 'Submit' button").
- Cognitive Ease: Maintains a 1:1 relationship between what is seen and how the element is identified.
Best Practices
✅ Start with the visible text: If you must use an aria-label, start it with the exact visible text.
✅ Prefer visible text: Whenever possible, avoid aria-label and rely on the actual text content of the element.
❌ Don't use completely different labels: Never have a visible label like "Save" and an accessible name like "Commit changes".
Exceptions
- Evaluate the rendered experience before treating a static-code smell as a blocker; interaction timing, browser behavior, and assistive technology output often determine severity.
- Not every secondary accessibility issue deserves equal weight; prioritize the issue that most directly blocks perception, operation, or understanding.
- Avoid adding redundant markup or ARIA solely to satisfy a rule when a simpler semantic implementation would eliminate the issue entirely.
Verification
Automated Checks
- Inspect the browser accessibility tree or accessibility pane for the relevant element, role, or accessible name.
- Run an automated accessibility checker such as axe or Lighthouse where applicable.
Manual Checks
- Test the affected UI with keyboard-only navigation and confirm the rule holds in the rendered experience.
- Re-test one representative user flow with a screen reader if this rule affects a key interaction.
Use with AI
Copy these prompts to use with your AI assistant, or install the MCP server to use directly from Claude, Cursor, or Windsurf.
Check
Verify implementation
Compare the visible text of buttons and links with their 'aria-label' or 'aria-labelledby' attributes to ensure the visible text is included in the accessible name.
Fix
Auto-fix issues
Update the ARIA attribute to include the exact string of the visible label text at the beginning of the accessible name.
Explain
Learn more
Explain how a mismatch between visible labels and accessible names breaks the experience for users of voice recognition software.
Review
Code review
Review the rendered markup and interactive states that affect Align visible labels with accessible names. Flag exact elements, roles, labels, focus behavior, or keyboard interactions that violate the rule, and note how to verify the fix with browser accessibility tooling or assistive tech.