About This HTML Issue
A span element has an implicit ARIA role of generic, and the aria-labelledby attribute is not allowed on elements with that role.
The span element is a generic inline container with no semantic meaning. Its default ARIA role is generic, and the ARIA specification explicitly prohibits naming generic elements with aria-labelledby (or aria-label). This restriction exists because accessible names on generic containers create confusing experiences for assistive technology users — screen readers wouldn't know what kind of thing is being labeled.
To fix this, you have two main options:
- Add a meaningful
roleto thespanthat supportsaria-labelledby, such asrole="group",role="region", or any other role that accepts a label. - Use a more semantic element that already has an appropriate role, like a
section,nav, ordivwith an explicit role.
If the span doesn't truly need a label, simply remove the aria-labelledby attribute.
HTML Examples
❌ Invalid: aria-labelledby on a plain span
<span id="label">Settings</span>
<span aria-labelledby="label">
<input type="checkbox" id="opt1">
<label for="opt1">Enable notifications</label>
</span>
✅ Fix: Add an appropriate role
<span id="label">Settings</span>
<span role="group" aria-labelledby="label">
<input type="checkbox" id="opt1">
<label for="opt1">Enable notifications</label>
</span>
✅ Fix: Use a semantic element instead
<span id="label">Settings</span>
<fieldset aria-labelledby="label">
<input type="checkbox" id="opt1">
<label for="opt1">Enable notifications</label>
</fieldset>
Find issues like this automatically
Rocket Validator scans thousands of pages in seconds, detecting HTML issues across your entire site.
Help us improve our guides
Was this guide helpful?
Validate at scale.
Ship accessible websites, faster.
Automated HTML & accessibility validation for large sites. Check thousands of pages against WCAG guidelines and W3C standards in minutes, not days.
Pro Trial
Full Pro access. Cancel anytime.
Start Pro Trial →Join teams across 40+ countries