Skip to Content Links: The Complete Code, Placement & Testing Guide
TABLE OF CONTENTS
- What is a skip to content link β and which WCAG criterion requires it?
- What's the correct markup?
- How do you style it β visible on focus?
- Where does focus go after activation?
- How do you add one to a Shopify theme?
- How do you test it in 60 seconds?
- Do landmarks make skip links obsolete?
- Frequently Asked Questions
Last updated: November 29, 2026
A skip to content link is a hidden-until-focused anchor at the top of a page that lets a keyboard user jump past the header straight into the main content, in one keystroke. It exists because WCAG 2.4.1 Bypass Blocks requires some mechanism to skip repeated content, and the skip link is the simplest, most tested way to satisfy it. This guide covers the exact markup, focus-visible CSS, where focus should land, adding one to Shopify, and a 60-second test.
Key numbers: WCAG 2.2's 2.4.1 Bypass Blocks is a Level A criterion, one of 86 in force (W3C). 95.9% of the top one million home pages carried a detectable WCAG failure in 2026, averaging 56.1 errors per page (WebAIM Million, 2026). TestParty has remediated 35 million-plus accessibility issues across 100+ brands as of 2026, and a skip link present in the markup but never actually visible on focus is a recurring audit finding (TestParty internal data). Shopify's Theme Store requirements cover only 16β22% of WCAG criteria, and stock Dawn still ships 30β100 detectable violations before customization β despite shipping a working skip link by default (TestParty audit data, 2026).
What is a skip to content link β and which WCAG criterion requires it?
A skip to content link is a plain anchor, first in tab order, that jumps a keyboard user straight into the main content β the canonical fix for WCAG 2.4.1 Bypass Blocks, a Level A criterion requiring "a mechanismβ¦to bypass blocks of content that are repeated on multiple web pages."
Three audiences need it, and only one is who most teams picture first. Keyboard users facing a forty-link mega menu every page load are the obvious case. Screen reader users have a second route β landmarks let them jump region-to-region by rotor, so a skip link is somewhat redundant there. Sighted keyboard users, tabbing due to RSI, a broken trackpad, or preference, with no screen reader running, are the audience most guides forget: no rotor, only Tab β which makes a skip link the one mechanism WCAG recognizes for them at all.
What's the correct markup?
The correct markup places a plain anchor first in the DOM, `href` pointing at the `id` on your main content landmark β everything past that is refinement, not requirement.
<!-- Fixes WCAG 2.4.1 (Bypass Blocks): the first focusable element on the
page, visually hidden until it receives focus -->
<a href="#main-content" class="skip-link">Skip to content</a>
<header><!-- logo, search, cart, mega menu --></header>
<nav aria-label="Main">...</nav>
<main id="main-content" tabindex="-1">
<h1>Product name</h1>
...
</main>
<!-- A collection or filter-heavy template can warrant more than one -->
<div class="skip-links">
<a href="#main-content" class="skip-link">Skip to content</a>
<a href="#filters" class="skip-link">Skip to filters</a>
</div>This matches WebAIM's skip-navigation technique: first, hidden by default, prominently visible on focus. The `tabindex="-1"` is the honest nuance: Safari historically wouldn't move focus to an element that wasn't already focusable, so it became the standard workaround. Current Chrome, Firefox, Safari, VoiceOver, JAWS, NVDA, and TalkBack now move focus correctly without it too, via a browser capability ("sequential focus navigation starting point") shipped for close to a decade β though `tabindex="-1"` on `<main>` has its own documented iOS Safari scroll-restoration quirk. Until you've verified your own matrix, keep it as the defensive default; drop it deliberately, not by accident. Add a second skip link whenever a template has another dense, repeated block worth bypassing on its own.
How do you style it β visible on focus?
Visible-on-focus CSS moves the skip link off-screen with position and clipping, then reverses it on `:focus` β never `display: none` or `visibility: hidden`, both of which pull the element out of the tab order entirely.
/* Fixes WCAG 2.4.1: hidden until focused, never unreachable β
position, NOT display:none (which removes it from Tab entirely) */
.skip-link {
position: absolute;
top: -40px;
left: 0;
z-index: 100;
padding: 12px 20px;
background: #1a1a1a;
color: #ffffff;
text-decoration: none;
font-weight: 600;
}
.skip-link:focus {
top: 0; /* moves on-screen the instant it receives keyboard focus */
outline: 3px solid #1a5fff;
outline-offset: 2px;
}Top-left is standard, since that's where DOM order and a sighted eye both land first. On-brand colors are fine if the link clears 4.5:1 text contrast and its background clears 3:1 against whatever sits behind it. Some sites β mostly government and enterprise properties β skip hide-until-focus and keep the link permanently visible, trading a few pixels of chrome for zero discovery risk; a legitimate call, not a requirement. MDN's `:target` can also briefly highlight `#main-content` after the jump β a nice-to-have, not a replacement.
Where does focus go after activation?
After activation, focus should land exactly on the target β not merely scroll it into view β and the next Tab press should continue into the main content, never loop back to the header.
The most common failure passes a glance test and fails instantly under a screen reader: the page scrolls, but focus never moved, so nothing is announced and the next Tab resumes from the header. Verify directly β activate the link, press Tab once more, then check `document.activeElement` in devtools; a pass shows the main element, not `<body>`. One nuance: some teams suppress `<main>`'s own focus ring with `outline: none` on that one container specifically β never extend that suppression to an actual link, button, or input.
// For a storefront that swaps <main>'s content without a full reload:
// a hash-only URL change doesn't retrigger native anchor focus
function onRouteChange() {
const main = document.getElementById('main-content');
main.setAttribute('tabindex', '-1');
main.focus(); // fixes 2.4.1 for dynamically rendered content
}How do you add one to a Shopify theme?
Dawn ships a skip-to-content link by default, first inside `<body>` before any header renders β most stock Dawn stores start compliant unless a customization removed it.
{% comment %} From Dawn's layout/theme.liquid, immediately after <body>,
before {% sections 'header-group' %} β fixes WCAG 2.4.1 {% endcomment %}
<a class="skip-to-content-link button visually-hidden" href="#MainContent">
{{ 'accessibility.skip_to_text' | t }}
</a>
<main id="MainContent" class="content-for-layout" role="main" tabindex="-1">
{{ content_for_layout }}
</main>For a theme that doesn't ship one, add the same pattern to `theme.liquid` right after `<body>`, ahead of the header include, then confirm every template renders `<main>` with that same id β TestParty's audits regularly find it works on the homepage and breaks where a custom section swapped in a layout that dropped the id. See TestParty's full Dawn audit and the merchant's 10-minute keyboard test, where this is literally the second thing checked.
How do you test it in 60 seconds?
Load the page, press Tab once, confirm the skip link becomes visible, press Enter, then Tab again β if that second Tab lands inside the main content instead of back at the header, the skip link works.
// Paste into devtools right after activating the skip link β
// confirms focus actually moved, not just that the page scrolled
console.log(document.activeElement);Three failures cover nearly everything that goes wrong: the link is permanently hidden by a competing CSS rule; the target id is missing or renamed on some templates, so it works on the page you tested and breaks elsewhere; or focus never actually moves β the most common false pass, since the page scrolls and looks correct without checking `document.activeElement`. Scanners flag a missing link or a broken `href`-to-`id` match; they can't confirm focus itself moved β the manual half of TestParty's usual 60β70% automated split (TestParty internal data), and a 60-second check every release.
Do landmarks make skip links obsolete?
No β landmarks give screen reader and switch-device users a second way to jump around, but a skip link remains the only mechanism a sighted keyboard user with no assistive technology running can reach, since landmark navigation lives inside software they never open.
A clean `<header>`/`<nav>`/`<main>` structure genuinely overlaps with a skip link for screen reader users, who jump landmark-to-landmark by rotor β TestParty's keyboard navigation guide covers that structure in full. But a sighted keyboard user has no rotor to open, so perfect landmarks with no skip link still forces a Tab through the whole header. WCAG 2.2 AA, explained plainly, lists 2.4.1 among the cheapest of its 55 criteria β both fixes together cost one anchor, a dozen CSS lines, and HTML you'd want anyway.
Frequently Asked Questions
Does a skip link have to say "Skip to content" exactly? No. It just needs to be self-explanatory out of context, since it's often the first thing announced on the page. "Skip to main content" and "Skip navigation" both work; avoid vague text like "Continue," which only makes sense with the page already visible.
Can I hide the link with `display: none` and show it via JavaScript instead of CSS? Technically, but it's more fragile. A script that fails to load or fires after first paint leaves a keyboard user with nothing to Tab to. The position-based CSS pattern keeps working even if every script on the page fails.
Should the skip link sit inside `<nav>` or `<header>`? No β outside every landmark, as the first element inside `<body>`. Wrapping it in `<nav>` adds one more landmark a screen reader user must pass through before reaching the control meant to save them a step.
What if a template has no single, obvious main-content block? That's a structure problem worth fixing first. Every content template should render exactly one `<main>` element; if a page genuinely can't produce one, the skip link has nothing valid to target.
Do single-page apps or infinite-scroll storefronts need a different approach? The markup is identical, but focus follow-through matters more: client-side routing doesn't trigger a full page load, so focus must move to the new content programmatically after each route change, or the link scrolls without moving focus.
Is one skip link always enough? It's the floor, not the ceiling. A simple homepage usually needs only "Skip to content." A collection page with a heavy filter sidebar benefits from an additional "Skip to filters" link.
TestParty practices a cyborg approach to content: AI assists with research and drafting, our accessibility experts validate every claim. This article represents our editorial perspective based on public data as of the publication date. We compete in the digital accessibility space β which means we have informed opinions, but also a vested interest. All sources are cited so you can draw your own conclusions.
Stay informed
Accessibility insights delivered
straight to your inbox.


Automate the software work for accessibility compliance, end-to-end.
Empowering businesses with seamless digital accessibility solutionsβsimple, inclusive, effective.
Book a Demo