liveBook · Manning

Skip link

As explained in Architecting Accessibility

A skip link is an interactive link that lets keyboard or assistive technology users bypass repeated content and move to a later page region.

Imagine using Tab to reach a contact form, only to pass the logo, menus, search, and account links on every page first. A skip link gives keyboard and screen reader users a shortcut past repeated content to a useful destination, usually the main content. section 5.3.3

Place skip links early in the page and keep their placement consistent across pages. Make the first link the first focusable element in the DOM so it appears when a keyboard user presses Tab after loading the page. section 5.1.4 section 5.3.3

<nav class="skip-links" aria-label="Skip links">
  <a href="#main-content">Skip to main content</a>
  <a href="#sidebar">Skip to sidebar</a>
  <a href="#site-navigation">Skip to site navigation</a>
</nav>

Use ordinary links with clear destinations. More than one shortcut can help when users need to reach distinct areas, such as main content or a sidebar. section 5.3.3

<nav id="site-navigation" aria-label="Main navigation">
...
<main id="main-content">
...
<aside id="sidebar" aria-labelledby="sidebar-heading">

Give each destination an id matching its link’s href. Native landmarks such as <main> can serve as skip-link targets. section 5.3.3 section 5.2

.skip-links { #A
    position: absolute;
    inset-block-start: 0;
    inset-inline-start: 0;
    z-index: 100; #B
}
 
.skip-links a { #C
  position: absolute;
  transform: translateY(-120%); #D
  background: #000;
  color: #fff;
  border: 2px solid currentColor;
  padding: 0.5rem 0.75rem;
  text-decoration: none;
  z-index: 1000;
}

.skip-links a:focus { #E
  transform: translateY(0); #F
}

:target { #G
    outline: 3px solid currentColor;
    outline-offset: 0.25rem;
}

Keep the links out of the way until they receive keyboard focus, then show them clearly. The target outline helps identify where the shortcut lands. section 5.3.3

TIP: Test from a freshly loaded page using only the keyboard: does the shortcut appear on the first Tab press, and does it reach the intended area? NOTE: A booking page might offer separate shortcuts to bypass navigation and reach search filters. Choose destinations that save users meaningful effort. section 5.3.3

How Architecting Accessibility covers it

How deep it goes
Works through link targets, DOM placement, focus visibility, and CSS styling; does not develop a custom interaction component.
Examples
Uses repeated menus before a contact form, a booking-site search-filter shortcut, and HTML and CSS listings.
What it assumes
Assumes basic HTML, CSS, and keyboard navigation while showing how to assemble the skip links themselves.
What you can do after
Build it from scratch with HTML links to page regions and CSS that reveals links on focus.
How it connects
Connects skip links to keyboard focus, repeated navigation, semantic HTML landmarks, and screen reader navigation.

Also explained in

Compare how 2 books explain skip link →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Architecting Accessibility. The section links point to the parts of the book it draws on.