Components
Skip link
The first focusable element on every page: a link to the main content, shown only when focused.
The first focusable element on every web page: a link that jumps past the site header and app bar to <main id="main">. It stays off screen until it takes keyboard focus, then shows as a Brand pill at the top leading corner. Press Tab in the frames on the Layout components to see it.
Live example
Rendered with the real classes from /site/chitransit.css, light (left) and dark (right); .is-visible shows the focused look without focus.
.ct-skip-link (focused)Code
<body>
<a class="ct-skip-link" href="#main">Skip to content</a>
<header class="ct-site-header">…</header>
<main id="main">…</main>
</body>
Tokens
From tokens/components.tokens.json. Override one instance by setting the property without the ct- prefix.
| Custom property | Value | Alias | Resolves to |
|---|---|---|---|
--ct-skip-link-background | var(--accent) | {colors.accent} | #0B4EA2 #92B8F5 |
--ct-skip-link-color | var(--accent-ink) | {colors.accentInk} | #FFFFFF #0F141C |
--ct-skip-link-font-size | var(--fs-body) | {type.body} | 16 |
--ct-skip-link-font-weight | var(--weight-semibold) | {weight.semibold} | 600 |
--ct-skip-link-height | var(--size-minimum-tap-target) | {size.minimumTapTarget} | 44 pt |
--ct-skip-link-inset | var(--space-8) | {space.s8} | 8 pt |
--ct-skip-link-padding-x | var(--space-16) | {space.s16} | 16 pt |
--ct-skip-link-radius | var(--radius-pill) | {radius.pill} | 999 pt |
--ct-skip-link-z-index | var(--z-skip-link) | {zIndex.skipLink} | 1200 index |
Variants
One form; no variants. .ct-skip-link stays off screen until it takes focus; .is-visible is for docs and screenshots only. Nothing else exists.
<!-- Do -->
<body>
<a class="ct-skip-link" href="#main">Skip to content</a>
…
<main id="main">…</main>
</body>
<!-- Don't: take it out of the tab order, or force it visible in a page -->
<a class="ct-skip-link" href="#main" style="display:none">Skip to content</a>
<a class="ct-skip-link is-visible" href="#main">Skip to content</a>
Usage
Do
- Make it the first element in
<body>on every page. - Point it at the
<main>landmark's id.
Don't
- Don't hide it with
display:none; it must stay focusable. - Don't add
.is-visiblein pages; it is for docs and screenshots.
Accessibility
- The first tab stop; visible whenever it has focus, with the focus ring.
- At least 44pt tall; Accent ink on Brand meets text contrast in both themes.
Contract
Contract: components/skip-link.yaml. States are drawn live by transit.js.
Loading the contract…