Skip Link
Example
.skip-link {
display: none;
}.skip-link {
position: absolute;
transform: translateY(-120%);
}
.skip-link:focus {
transform: translateY(0);
}The link stays in the tab order and slides into view when focused.
Common mistakes
- Hiding the skip link with
display: none, so keyboard users cannot reach it. - The link stays off-screen on focus, so sighted keyboard users don't see it.
Key points
- The skip link is the first focusable element in the page.
- It points to an
idon<main>that exists, likehref="#main". - It is visible when focused, not hidden with
display: none. - The target can receive focus, for example with
tabindex="-1"on<main>.
Interview questions
Do I need a skip link if I use landmarks?
Yes. Landmarks help screen reader users, but sighted keyboard users have no other way to skip menus.
Why add tabindex="-1" to <main>?
tabindex="-1" to <main>?It makes sure focus moves to the target, so the next Tab continues from the main content.