Skip to main content
HTML Validation

An element with the attribute “role=tab” must not appear as a descendant of the “a” element.

About This HTML Issue

An element with role="tab" is interactive, so it can't sit inside an <a> element, which is interactive too.

The content model of <a> forbids interactive descendants, and ARIA in HTML counts any element with an interactive role, such as tab, as one. When a tab sits inside a link, assistive technologies get two controls in one spot: the outer element is announced as a link, the inner one as a tab, and it's unclear which of the two a click or the Enter key activates. The link also gets between the tablist and its tabs, so screen readers may not announce the tab's position in the set.

This markup often comes from older accordion components, where a link wraps the clickable header and the header carries role="tab". Keep one interactive element per control. For a set of tabs, put role="tab" on the control itself, usually a <button>, inside a role="tablist" container. An <a href> may also take role="tab" directly, but then it behaves as a tab, not a link. If the component is really an accordion, drop the tab roles and use a button inside a heading.

Invalid example

<div role="tablist">
  <a href="#panel-1">
    <div role="tab" id="tab-1">Shipping</div>
  </a>
  <a href="#panel-2">
    <div role="tab" id="tab-2">Returns</div>
  </a>
</div>
<div id="panel-1" role="tabpanel" aria-labelledby="tab-1">Orders ship within two days.</div>
<div id="panel-2" role="tabpanel" aria-labelledby="tab-2" hidden>Returns are free for 30 days.</div>

Valid example

<div role="tablist">
  <button type="button" role="tab" id="tab-1" aria-selected="true" aria-controls="panel-1">Shipping</button>
  <button type="button" role="tab" id="tab-2" aria-selected="false" aria-controls="panel-2" tabindex="-1">Returns</button>
</div>
<div id="panel-1" role="tabpanel" aria-labelledby="tab-1">Orders ship within two days.</div>
<div id="panel-2" role="tabpanel" aria-labelledby="tab-2" hidden>Returns are free for 30 days.</div>

Valid example for an accordion

<h3>
  <button type="button" aria-expanded="false" aria-controls="section-1">Shipping</button>
</h3>
<div id="section-1" hidden>Orders ship within two days.</div>

Tab switching and the aria-expanded toggle still need JavaScript, but the markup no longer nests one control inside another.

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
€5 / week

1K Weekly

1,000 monthly checks. Cancel anytime.

Get 1K Weekly →

Join teams across 40+ countries