VERIFICATION-0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF
Skip to main contentSkip link
<forma-skip-link>
First focusable link that jumps to main content; visually hidden until focused.
- Authoring tag
<forma-skip-link>- Category
- Navigation
- Behavior owner
- Native HTML
- Canonical source
patterns/skip-link.html
Purpose
A skip link lets keyboard and switch users bypass repeated header and navigation links. It is an ordinary in-page link placed first inside the marketing shell (.forma-site), pointing at the main content, which carries tabindex="-1" so it can receive focus. Forma keeps the link fixed near the top inline-start corner and translated off-screen; it snaps into view when it receives focus. Following it is native fragment navigation: the browser scrolls to the target and moves focus there, so the next Tab continues inside the content.
Use when
- A page built on the marketing shell has a header or navigation before the main content.
- Several skip targets are useful on long pages, such as the main content and a search form.
- You need a WCAG 2.4.1 bypass mechanism without script.
Avoid when
- The page is an application screen outside
.forma-site:.forma-skip-linklives in the marketing layer and depends on its tokens, so use an application-level equivalent. - You want to hide content from sighted users permanently: use Visually hidden.
- You need in-page navigation between sections: use a visible table of contents or Documentation layout navigation.
Behavior to know
- Fixed at the top inline-start corner with a high stacking order, above a sticky header.
- Hidden by
translateY(-200%), notdisplay: none, so it stays focusable and in the accessibility tree. - Revealed on
:focusand:focus-visible, with the shell's standard focus ring. - At least
--forma-layout-target-min(2.75rem) tall with bold text; removed when printing.
Basic example
The smallest correct markup: the canonical pattern from patterns/skip-link.html inside its public tag. Copy this first, then adapt labels, names and state. This component owns a page's main landmark, so it renders in its own document below.
Minimal skip link
Rendered from the canonical pattern file.
Live demo. 1 native action works here and is verified by an outcome test.
<forma-skip-link class="forma-component-tag">
<div class="forma-site">
<a class="forma-skip-link" href="#skip-link-main">Skip to main content</a>
<main id="skip-link-main" tabindex="-1">
<h1>Account settings</h1>
</main>
</div>
</forma-skip-link>
Click or tap the code once to select all of it, then copy.
Examples
Before a site header
The skip link comes first, before the site header's brand and navigation links. Its target is the content region with tabindex="-1". In a real page that region is the single main element; it is a section here because the documentation page already has one.
Live demo. 5 native actions work here and are verified by an outcome test.
<forma-skip-link class="forma-component-tag">
<div class="forma-site">
<a class="forma-skip-link" href="#skip-header-content">Skip to main content</a>
<header class="forma-site-header">
<div class="forma-site-header__inner">
<div class="forma-site-header__identity">
<a class="forma-site-header__brand" href="#skip-header-content"><span class="forma-site-header__mark" aria-hidden="true">EX</span><span class="forma-site-header__name">Example / Docs</span></a>
</div>
<nav class="forma-site-nav" aria-label="Example site">
<ul class="forma-site-nav__list">
<li><a class="forma-site-nav__link" href="#skip-header-content" aria-current="page">Guides</a></li>
<li><a class="forma-site-nav__link" href="#skip-header-content">Reference</a></li>
<li><a class="forma-site-nav__link" href="#skip-header-content">Support</a></li>
</ul>
</nav>
</div>
</header>
<section id="skip-header-content" tabindex="-1" aria-labelledby="skip-header-title">
<h2 id="skip-header-title">Guides</h2>
<p>Press Tab from the top of this example to reveal the skip link.</p>
</section>
</div>
</forma-skip-link>
Click or tap the code once to select all of it, then copy.
Main content and search targets
A long page with two skip links. Each is hidden until focused and appears in the same corner, so only the focused one is ever visible. The search target is the form's labelled input, which is natively focusable.
Live demo. 2 native actions work here and are verified by an outcome test.
Release notes
Version 4.2 adds regional failover and faster exports.
<forma-skip-link class="forma-component-tag">
<div class="forma-site">
<a class="forma-skip-link" href="#skip-multi-content">Skip to main content</a>
<a class="forma-skip-link" href="#skip-multi-search">Skip to search</a>
<section id="skip-multi-content" tabindex="-1" aria-labelledby="skip-multi-title">
<h2 id="skip-multi-title">Release notes</h2>
<p>Version 4.2 adds regional failover and faster exports.</p>
</section>
<form role="search" aria-label="Release notes">
<label for="skip-multi-search">Search release notes</label>
<input id="skip-multi-search" name="skip-multi-q" type="search">
</form>
</div>
</forma-skip-link>
Click or tap the code once to select all of it, then copy.
Mobile
Each mobile example renders in its own document inside a real narrow viewport, so Forma's media and container queries run exactly as they would on a phone. Choose a width to compare.
Translated skip link on a phone
A French skip link at phone width. When focused it appears in the top corner of the viewport, clear of the sticky header.
Live demo. 1 native action works here and is verified by an outcome test.
What changes at narrow widths
- Position is fixed relative to the viewport, so the link appears in the top inline-start corner even when the page is scrolled.
- The link keeps a 2.75rem (44px) minimum height, so it is a usable tap target for switch and external-keyboard users on tablets and phones.
- Longer translated labels widen the link; it is inline-flex and sized to its text, so at 320px a very long label can reach the far edge. Keep the label short.
- Touch-only users rarely focus it; it matters for keyboard, switch and screen reader navigation on mobile devices.
<forma-skip-link class="forma-component-tag">
<div class="forma-site" lang="fr">
<a class="forma-skip-link" href="#skip-mobile-content">Aller au contenu</a>
<section id="skip-mobile-content" tabindex="-1" aria-labelledby="skip-mobile-title">
<h2 id="skip-mobile-title">Paramètres du compte</h2>
<p>Gérez votre profil et vos notifications.</p>
</section>
</div>
</forma-skip-link>
Click or tap the code once to select all of it, then copy.
Mobile · 320px
The canonical pattern in a true 320px viewport, the minimum width every Forma component must support without page-level horizontal scrolling.
Live demo. 1 native action works here and is verified by an outcome test.
API and configuration
Forma components have no JavaScript API. Their public contract is the markup: native elements and attributes you write, and the CSS hooks below. The CSS hook table is generated from the built stylesheet, so it always matches the shipped implementation.
| Attribute | On | Values | Default | Description |
|---|---|---|---|---|
href | a.forma-skip-link | #id of the target | — | Fragment link to the main content (or another skip target). Native navigation moves focus there. |
tabindex | target | -1 | — | Required on non-focusable targets such as main, so the browser can move focus to them without adding them to the Tab order. |
id | target | string | — | Unique fragment identifier referenced by the skip link. |
lang | shell or link | language tag | inherited | Declare the language when the skip link text differs from the page language. |
| Hook | Kind | Values or default | Description |
|---|---|---|---|
.forma-skip-link | Block class | — | The skip link. Fixed at --forma-space-2 from the top inline-start corner, translated off-screen until :focus, then shown with the primary surface, bold text and the shell's focus ring. Hidden in print. Requires the marketing layer inside .forma-site. |
| Keys | Result |
|---|---|
| Tab (first press on the page) | Focuses the skip link and reveals it. |
| Enter | Follows the link: the browser scrolls to the target and moves focus to it (native). |
| Tab after skipping | Continues from the first focusable element inside the target, bypassing the header. |
Form behavior
Does not participate in forms.
States
| State | How it is expressed | Presentation |
|---|---|---|
| Hidden | not focused | Translated above the viewport; still focusable and announced. |
| Visible | :focus / :focus-visible | Shown in the top corner with the shell focus ring. |
| @media print | Removed from printed output. |
Accessibility
Forma provides
- Keeps the link in the accessibility tree and Tab order while visually hidden.
- Reveals it on focus above sticky headers with a visible focus ring and a 44px target.
- Removes it from print, where it has no purpose.
Your application supplies
- Place the skip link as the first focusable element inside
.forma-site. - Give the target an id and tabindex="-1" and use exactly one main element as the primary target.
- Write the text as an action, such as Skip to main content, in the page language.
Responsive behavior
- Fixed positioning relative to the viewport; no breakpoints.
- Inline-flex and sized to its text, with inline padding of
--forma-space-4. - Minimum block size is
--forma-layout-target-minat every width.
Motion
- No animation: the link snaps into view on focus and out again on blur. The marketing layer also removes any transitions under
prefers-reduced-motion: reduce.
Usage guidance
Do
- Test with Tab from a fresh page load: the skip link must be the first stop.
- Keep skip targets to the few that matter most.
Avoid
- Hiding the link with display: none or visibility: hidden, which removes it from the Tab order.
- Pointing at a target without tabindex="-1", which scrolls but leaves focus behind in some browsers.
Verification specimens
Generated fault-injection specimens expose content, spacing, color-cue, and reduced-effective-contrast risks. They screen presentation robustness as engineering screens without claiming human-subject validation.