Elements with visible text labels do not have matching accessible names
How to fix the label-content-name-mismatch accessibility rule. Headings and landmarks.
The message you saw
Lighthouse runs axe-core inside it, so both are the same check, and the fix below works whichever tool showed you the message.
What it means
A button or link can have two names: the text you see, and an accessible name set with aria-label or aria-labelledby, which replaces the visible text for assistive technology. This message means the accessible name doesn’t contain the visible text. For example, a button showing “Send” has aria-label="Submit form".
WCAG 2.5.3 Label in Name asks that the visible words are part of the accessible name, ideally at the start. axe checks controls that have both visible text and an aria-label or aria-labelledby, and compares the words, ignoring case and punctuation.
Who is affected
The control's visible text isn't part of its accessible name (usually an aria-label replaced it). Voice-control users say what they see, and nothing happens.
Voice-control users (Dragon, Voice Control on Mac and iPhone, Voice Access on Android) press buttons by saying what they see: “click Send”. If the button’s name is “Submit form”, nothing happens. Screen-reader users who can partly see the screen also get confused when the spoken name doesn’t match the words in front of them.
How to find it
- Run the checker: each case shows the visible text and the accessible name.
- Search for
aria-labelon elements that already have text inside. Often the aria-label was added for SEO or by a component library default.
How to fix it
- Usually the best fix is to remove the
aria-label, so the visible text becomes the name. - If you need extra context for screen readers, start the
aria-labelwith the visible words and add to the end: visible “Read more”, aria-label “Read more about pricing”. - Or keep the visible text as the name and give the extra context with
aria-describedby.
Examples
Button with a different aria-label
Before
<button aria-label="Submit form">Send</button>After
<button>Send</button>Adding context, keeping the visible words first
Before
<a href="/pricing" aria-label="Pricing details">Read more</a>After
<a href="/pricing" aria-label="Read more about pricing">Read more</a>Common mistakes
- Icon-only buttons aren’t covered: with no visible text there is nothing to match. They need an
aria-labelanyway. - For checkboxes, radio buttons and switches, axe marks mismatches as “needs review”, because the visible text may describe the value rather than the control.
WCAG success criteria
When this rule fails, the page fails:
- 2.5.3 Label in Name (Level A, WCAG 2.1, 2.2)
Check your fix
Scan a web page and the report lists every element that fails this rule, with screenshots outlining where they are, the code, and a selector you can paste into your browser’s developer tools. Scan again after your change: when the rule no longer appears under the problems, the fix worked.
An automated pass means this rule found nothing wrong. It doesn’t prove the page is accessible: some of what WCAG asks for needs a person to check, and the report’s manual checklist lists those steps.
Related fix guides
- Buttons do not have an accessible name
- Links do not have a discernible name
- Form elements do not have associated labels
More detail
- Deque University’s reference for label-content-name-mismatch (the makers of axe-core, the engine our scanner uses)
- W3C’s Understanding 2.5.3
- All fix guides