Hub: index · watch · videos · demo

Tabs: make a real tablist (keyboard + ARIA)

Tabs can be a great way to switch between views inside a single page. The problem: many implementations are just clickable <div> elements, which breaks keyboard navigation and doesn’t communicate relationships to assistive technology.

Live demo (no tracking):

Open tabs demo (BEFORE vs AFTER)

Tabs vs accordion (quick rule of thumb)

If the content is long or users may want multiple sections visible, consider an accordion instead (see: accordion note).

Semantic requirements (what makes it a real tablist)

Keyboard interactions

Activation modes: some tablists are automatic (moving focus also selects) and some are manual (focus moves; Enter/Space selects). Pick one and make it consistent.

Common pitfalls

Minimal markup (AFTER)

Example skeleton (you still need JS to manage aria-selected, roving tabindex, and hidden):

<div role="tablist" aria-label="Example">
  <button id="tab-a" role="tab" aria-selected="true" aria-controls="panel-a" tabindex="0">A</button>
  <button id="tab-b" role="tab" aria-selected="false" aria-controls="panel-b" tabindex="-1">B</button>
</div>

<div id="panel-a" role="tabpanel" aria-labelledby="tab-a">...</div>
<div id="panel-b" role="tabpanel" aria-labelledby="tab-b" hidden>...</div>