Skip to main content
HTML Validation

The “aria-labelledby” attribute must not be specified on any “span” element unless the element has a “role” value other than “caption”, “code”, “deletion”, “emphasis”, “generic”, “insertion”, “paragraph”, “presentation”, “strong”, “subscript”, or “superscript”.

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:

  1. Add a meaningful role to the span that supports aria-labelledby, such as role="group", role="region", or any other role that accepts a label.
  2. Use a more semantic element that already has an appropriate role, like a section, nav, or div with 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?
🌍 Trusted by teams worldwide

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.

Scheduled Reports
API Access
Open Source Standards
$7 / 7 days

Pro Trial

Full Pro access. Cancel anytime.

Start Pro Trial →

Join teams across 40+ countries