Skip to content
Fleetline

Visually hidden

Usage

Visually hidden content is read by screen readers but takes no space on screen. Use it to add context sighted users get from layout: "Error:" before a field message, the vehicle name after a repeated "Edit" link, the column a table cell belongs to.

Anatomy

  1. Hidden text — .sr-only (defined in css/base.css, utilities layer)
  2. Revealed skip link — .sr-only--focusable + .skip-link

Examples

Visually hidden

Van KX-219 · Edit van KX-219

Screen readers hear "Edit van KX-219"; sighted users see "Edit" next to the vehicle.

The first link is hidden until you Tab to it; the second shows its focused look (frozen with .is-focus-visible).

<a href="/vehicles/kx-219/edit">Edit<span class="sr-only"> van KX-219</span></a>

<!-- First element in <body> -->
<a class="skip-link sr-only sr-only--focusable" href="#main">Skip to main content</a>

API

HookValuesPurpose
.sr-onlyutility class (base.css)Hide visually, keep for assistive tech
.sr-only--focusableutility class (base.css)Reveal on :focus-visible / :active
.skip-linkclass (visually-hidden.css)Inverse surface and focus ring when revealed
.is-focus-visibledocs-only classFreezes the revealed state

Do and don't

View history for truck HT-507

Do complete repeated link text so it makes sense out of context.

Status: Overdue

Don't hide information sighted users need too; status must be visible text.

Accessibility

Keyboard interaction
KeyBehavior
Tab (first press)Reveals and focuses the skip link
EnterMoves to the main content

Tokens

Custom propertyPurpose
--color-bg-inverse, --color-text-inverseRevealed skip link surface and text
--space-2 | -4, --radius-mdSkip link padding and shape
--focus-ring-width | -offset | -colorFocus ring