HTML Guide for complementary
The role attribute exposes an element’s purpose to assistive technologies. ARIA defines a fixed set of role values; sidebar is not among them, so validators report a bad value. Sidebars typically contain related or ancillary content, which maps to the complementary landmark role. In HTML, the <aside> element already represents this concept and implicitly maps to the complementary role.
Leaving an invalid role harms accessibility because screen readers may ignore the landmark or misreport it, and automated tools can’t build a reliable landmarks map. Standards compliance also matters for consistent behavior across browsers and assistive tech.
To fix it:
- Replace role="sidebar" with role="complementary" on a generic container; add an accessible name with aria-labelledby or aria-label when multiple complementary regions exist.
- Prefer <aside> for semantic HTML. It implicitly has the complementary role; add a label when there is more than one <aside>.
- Do not add role="complementary" to <aside> unless you need to override something; duplicate roles are unnecessary.
- If the area is site-wide navigation, use <nav> or role="navigation" instead; choose the role that best matches the intent.
Examples
Invalid: non-existent ARIA role
<div role="sidebar">
<!-- Related links and promos -->
</div>
Fixed: use the complementary role on a generic container
<div role="complementary" aria-labelledby="sidebar-title">
<h2 id="sidebar-title">Related</h2>
<ul>
<li><a href="/guide-a">Guide A</a></li>
<li><a href="/guide-b">Guide B</a></li>
</ul>
</div>
Fixed: use semantic HTML with aside (implicit complementary)
<aside aria-labelledby="sidebar-title">
<h2 id="sidebar-title">Related</h2>
<ul>
<li><a href="/guide-a">Guide A</a></li>
<li><a href="/guide-b">Guide B</a></li>
</ul>
</aside>
Multiple sidebars: ensure unique, descriptive labels
<aside aria-labelledby="filters-title">
<h2 id="filters-title">Filter results</h2>
<!-- filter controls -->
</aside>
<aside aria-labelledby="related-title">
<h2 id="related-title">Related articles</h2>
<!-- related links -->
</aside>
When it’s actually navigation: use the navigation landmark
<nav aria-label="Section navigation">
<ul>
<li><a href="#intro">Intro</a></li>
<li><a href="#examples">Examples</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
</nav>
Tips:
- Use <aside> for tangential content; it’s the simplest, standards-based approach.
- Provide an accessible name when more than one complementary region is present.
- Avoid inventing ARIA roles; stick to defined values like banner, main, navigation, complementary, contentinfo, and others.
ARIA defines a fixed set of role values that user agents and assistive technologies understand. sidebar is not in that set, so role="sidebar" fails conformance checking and gives unreliable signals to screen readers. Using a valid role or the correct HTML element improves accessibility, ensures consistent behavior across browsers and AT, and keeps your markup standards‑compliant.
Sidebars typically contain tangential or ancillary content (e.g., related links, promos, author info). The ARIA role that matches that meaning is complementary. In HTML, the semantic element for the same concept is aside, which by default maps to the complementary landmark in accessibility APIs. Prefer native semantics first: use <aside> when possible. Only add role="complementary" when you can’t change the element type or when you need an explicit landmark for non-semantic containers.
How to fix:
- If the element is a sidebar: change <div role="sidebar"> to <aside> (preferred), or to <div role="complementary">.
- Ensure each page has at most one primary main region and that complementary regions are not essential to understanding the main content.
- Provide an accessible name for the complementary region when multiple exist, using aria-label or aria-labelledby, to help users navigate landmarks.
Examples
Triggers the validator error
<div role="sidebar">
<!-- Sidebar content -->
</div>
Fixed: use the semantic element (preferred)
<aside aria-label="Related articles">
<!-- Sidebar content -->
</aside>
Fixed: keep the container, apply a valid role
<div role="complementary" aria-label="Related articles">
<!-- Sidebar content -->
</div>
Full document example with two sidebars (each labeled)
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Sidebar Landmarks Example</title>
</head>
<body>
<header>
<h1>News Today</h1>
</header>
<main id="main">
<article>
<h2>Main Story</h2>
<p>...</p>
</article>
</main>
<aside aria-label="Trending topics">
<ul>
<li>Science</li>
<li>Politics</li>
<li>Sports</li>
</ul>
</aside>
<div role="complementary" aria-labelledby="sponsor-title">
<h2 id="sponsor-title">Sponsored</h2>
<p>Ad content</p>
</div>
<footer>
<p>© 2026</p>
</footer>
</body>
</html>
Notes:
- Do not invent ARIA roles (e.g., sidebar, hero, footer-nav). Use defined roles like complementary, navigation, banner, contentinfo, and main.
- Prefer native HTML elements (aside, nav, header, footer, main) over generic containers with roles.
- Label multiple complementary landmarks to make them distinguishable in screen reader landmark lists.
Using the <aside> element will automatically communicate a section has a role of complementary, so specifying the role="complementary" is redundant.