NavigationFree
Off-canvas Drawer
Two side panels, one from each edge, that open over the page as native modal dialogs and give focus back to their button when they close.
A tab list with three panels, arrow-key, Home and End support and roving tabindex, built with the XON tabs words.
Checked on 3 December 2026 in Chrome 143.0.7499.169: 12 automated checks. What the checks are
<section class="atb" aria-labelledby="atb-title">
<h2 id="atb-title" class="atb__title">How a tab list works</h2>
<div class="atb__tabs" data-tabs>
<div class="atb__strip">
<button type="button" class="atb__tab" id="atb-tab-overview" data-tab="atb-overview">Overview</button>
<button type="button" class="atb__tab" id="atb-tab-keys" data-tab="atb-keys">Keyboard</button>
<button type="button" class="atb__tab" id="atb-tab-markup" data-tab="atb-markup">Markup</button>
</div>
<div class="atb__panel" id="atb-overview">
<p class="atb__text">A tab list is a row of buttons that each reveal one panel. Only one panel shows at a time, so a long page stays short and the choices stay in one place.</p>
<p class="atb__text">The library adds the roles and keeps <code>aria-selected</code> in step, so a screen reader announces "tab 1 of 3".</p>
<button type="button" class="atb__next" id="atb-next-overview" data-on-click="atbNext" data-next="atb-tab-keys">Next: Keyboard</button>
</div>
<div class="atb__panel" id="atb-keys" hidden>
<ul class="atb__keys">
<li><span class="atb__combo"><kbd>Tab</kbd></span> enters the tab list, then moves on to the panel.</li>
<li><span class="atb__combo"><kbd>←</kbd> <kbd>→</kbd></span> move between the tabs and show their panel.</li>
<li><span class="atb__combo"><kbd>Home</kbd> <kbd>End</kbd></span> jump to the first or last tab.</li>
</ul>
<button type="button" class="atb__next" id="atb-next-keys" data-on-click="atbNext" data-next="atb-tab-markup">Next: Markup</button>
</div>
<div class="atb__panel" id="atb-markup" hidden>
<p class="atb__text">One wrapper, one button per panel, and the panel ids.</p>
<pre class="atb__code" tabindex="0"><code><div data-tabs>
<button type="button" data-tab="one">One</button>
<button type="button" data-tab="two">Two</button>
<div id="one">…</div>
<div id="two" hidden>…</div>
</div></code></pre>
<button type="button" class="atb__next" id="atb-next-markup" data-on-click="atbNext" data-next="atb-tab-overview">Back to the start</button>
</div>
</div>
</section>.atb {
--atb-surface: #ffffff;
--atb-fg: #1b2032;
--atb-muted: #4a5266;
--atb-line: #d3d8e6;
--atb-accent: #4338ca;
--atb-on-accent: #ffffff;
--atb-soft: #eceeff;
--atb-code-bg: #f3f4fb;
--atb-ring: #4338ca;
box-sizing: border-box;
width: min(100%, 34rem);
padding: 1.25rem 1.25rem 1.5rem;
color: var(--atb-fg);
background: var(--atb-surface);
border: 1px solid var(--atb-line);
border-radius: 16px;
box-shadow: 0 10px 30px -18px rgba(27, 32, 50, 0.4);
}
.atb *, .atb *::before, .atb *::after { box-sizing: border-box; }
.atb__title { margin: 0 0 0.9rem; font-size: 1.25rem; line-height: 1.3; letter-spacing: -0.01em; }
.atb__strip { display: flex; width: 0; min-width: 100%; gap: 0.25rem; border-bottom: 2px solid var(--atb-line); overflow-x: auto; }
.atb__tab {
flex: 0 0 auto;
min-height: 44px;
padding: 0.5rem 1rem;
margin-bottom: -2px;
font: inherit;
font-weight: 600;
color: var(--atb-muted);
background: transparent;
border: 0;
border-bottom: 3px solid transparent;
border-radius: 8px 8px 0 0;
cursor: pointer;
transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}
.atb__tab:hover { color: var(--atb-fg); background: var(--atb-soft); }
.atb__tab[aria-selected="true"] { color: var(--atb-accent); border-bottom-color: var(--atb-accent); }
.atb__tab:focus-visible, .atb__next:focus-visible, .atb__code:focus-visible, .atb__panel:focus-visible { outline: 3px solid var(--atb-ring); outline-offset: 2px; }
.atb__tab:focus-visible { outline-offset: -3px; }
.atb__panel { padding: 1.1rem 0.15rem 0; border-radius: 8px; }
.atb__text { margin: 0 0 0.75rem; line-height: 1.6; }
.atb__text code, .atb__keys code { padding: 0.1em 0.35em; font-size: 0.9em; background: var(--atb-code-bg); border-radius: 5px; }
.atb__keys { display: grid; gap: 0.7rem; margin: 0 0 1rem; padding: 0; list-style: none; }
.atb__keys li { display: grid; grid-template-columns: 7.5rem 1fr; align-items: center; gap: 0.75rem; line-height: 1.45; }
.atb__combo { display: inline-flex; gap: 0.3rem; }
.atb__keys kbd {
display: inline-block;
min-width: 2rem;
padding: 0.2rem 0.45rem;
font: 600 0.8125rem/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
text-align: center;
color: var(--atb-fg);
background: var(--atb-code-bg);
border: 1px solid var(--atb-line);
border-bottom-width: 3px;
border-radius: 6px;
}
.atb__code {
width: 0;
min-width: 100%;
margin: 0 0 1rem;
padding: 0.85rem 1rem;
overflow-x: auto;
font: 0.8125rem/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
color: var(--atb-fg);
background: var(--atb-code-bg);
border: 1px solid var(--atb-line);
border-radius: 10px;
}
.atb__next {
min-height: 44px;
padding: 0.5rem 1.1rem;
font: inherit;
font-weight: 600;
color: var(--atb-on-accent);
background: var(--atb-accent);
border: 2px solid var(--atb-accent);
border-radius: 10px;
cursor: pointer;
}
.atb__next:hover { filter: brightness(1.1); }
@media (max-width: 30em) {
.atb { padding: 1rem; }
.atb__tab { padding: 0.5rem 0.65rem; }
.atb__keys li { grid-template-columns: 1fr; gap: 0.25rem; }
}
@media (prefers-color-scheme: dark) {
.atb {
--atb-surface: #1a1e2e;
--atb-fg: #edf0fa;
--atb-muted: #b3b9ce;
--atb-line: #3a4157;
--atb-accent: #aeb1ff;
--atb-on-accent: #14162b;
--atb-soft: #272c47;
--atb-code-bg: #11131f;
--atb-ring: #c9cbff;
box-shadow: none;
}
}
@media (prefers-reduced-motion: reduce) {
.atb__tab { transition: none; }
}// The tab list itself needs no script: data-tabs and data-tab do the roles, the states and the arrow keys.
// This function is only for the "Next" buttons: it selects the tab named in data-next and moves focus to it.
function atbNext(event, button) {
var tab = document.getElementById(button.dataset.next);
if (!tab) return;
tab.click();
tab.focus();
}
xon.use(atbNext);Written by the author of the snippet. Each note has a test step or a markup check that reads the page.
NavigationTwo side panels, one from each edge, that open over the page as native modal dialogs and give focus back to their button when they close.
NavigationA site header whose links fold behind a Menu button on phones and sit in a row from 40em, written without a library.
NavigationA breadcrumb trail and a numbered pager with previous, next and gaps, built from real links that fold to a compact pager on phones.