Skip Link
A hidden link that lets keyboard users jump straight to the main content, bypassing repetitive navigation.
The Bad (Inaccessible)
<header>
<nav>
<a href="/">Home</a>
<a href="/about">About</a>
</nav>
</header>
Accessibility-Ready Code
<a href="#main-content" class="skip-link">
Skip to main content
</a>
a.skip-link(href="#main-content") Skip to main content
<a href="#main-content" className="skip-link">
Skip to main content
</a>
<a href="#main-content" class="skip-link">
Skip to main content
</a>
<a
href="#main-content"
class="absolute left-4 -top-full focus:top-4 bg-indigo-600 text-white px-6 py-3 rounded-md z-50 transition-all font-semibold"
>
Skip to main content
</a>
The Standard
A Skip Link is an invisible link that becomes visible on keyboard focus. It allows users to skip directly to the <main> content, bypassing the header, navigation, and other repeated elements.
WCAG Criteria
- 2.4.1 Bypass Blocks (Level A): A mechanism must exist to bypass blocks of content that are repeated on multiple pages.
β The Bad (Inaccessible)
<!-- π« Without a skip link, users must tab through dozens of links to reach content -->
<header>
<nav>
<a href="/">Home</a>
<a href="/about">About</a>
<!-- ...20 more links... -->
</nav>
</header>
<main>
<!-- The actual content -->
</main>
// React
// π« Without a skip link, users must tab through dozens of links to reach content
function App() {
return (
<>
<header>
<nav>
<a href="/">Home</a>
<a href="/about">About</a>
{/* ...20 more links... */}
</nav>
</header>
<main>
{/* The actual content */}
</main>
</>
);
}
<!-- Vue -->
<!-- π« Without a skip link, users must tab through dozens of links to reach content -->
<template>
<header>
<nav>
<a href="/">Home</a>
<a href="/about">About</a>
<!-- ...20 more links... -->
</nav>
</header>
<main>
<!-- The actual content -->
</main>
</template>
Whatβs Wrong?
- Tedious Navigation: Keyboard users must press
Tab20+ times to reach the main content. - Excludes Screen Reader Users: They must listen to every link before reaching what they came for.
β The Good (Accessibility-Ready Code)
Why This Works
- Instant Bypass: Pressing
Tabonce reveals the skip link. PressingEnterjumps to<main>. tabindex="-1"on Main: Allows focus to be moved to the<main>element programmatically.- Visually Hidden Until Focused: Styled to appear only on
:focus.
Accessibility Checklist
- Place the skip link as the first focusable element in the
<body>. - The target element (e.g.,
<main>) must have a matchingid. - Add
tabindex="-1"to the target if itβs not natively focusable. - Style with
.sr-only:focusto make it visible only on focus.
<body>
<a href="#main" class="skip-link">Skip to content</a>
...
<main id="main" tabindex="-1">
<h1>Content Starts Here</h1>
</main>
</body>
CSS for Skip Link
.skip-link {
position: absolute;
top: -100%;
left: 16px;
background: #0f172a;
color: white;
padding: 12px 24px;
z-index: 1000;
border-radius: 8px;
transition: top 0.2s;
}
.skip-link:focus {
top: 16px;
} Interactive Behavioral Lab
Interactive Sandbox
π¬ Technical Internals
Understand how this component is processed by the browser and Assistive Technology (AT). This section bridges the gap between visual code and the hidden logic that powers accessibility.
π² Accessibility Tree
The data structure used by screen readers to "see" your page. It translates HTML roles and attributes into standardized objects.
βοΈ Event Logic
Expected behavioral standards for keyboard navigation and state transitions. Crucial for users who don't use a mouse.
- Focus: Highlights via
:focus-visible - Activation: Responds to
EnterandSpace - Role: Identified as
Skip Link