Navigation
SkipLink and VisuallyHidden
The first link on the page jumps past the navigation; hidden text gives screen readers context the screen already shows.
Ant Design: -
import { SkipLink, VisuallyHidden } from '@alea/ui';
Examples
Skip link
Press Tab on this page: the first stop is the skip link (shown here inside the preview).
Props
SkipLink props
The first link on the page: hidden until focused, it jumps past the navigation to the content (Chakra SkipNav).
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | 'Skip to content' | The link text. Default "Skip to content". |
target | string | 'main' | The id of the main content, without #. Default "main". |
Accessibility
- SkipLink is hidden until it gets focus, then slides in at the top left. Put it first in the body and give your main element the same id.
- VisuallyHidden keeps text in the accessibility tree; never use it to hide things sighted keyboard users need.
Keyboard
| Key | Does |
|---|---|
| Tab (first) | Shows the skip link |
| Enter | Jumps to the content |
Do and don't
Do
- Put SkipLink first in every page with navigation before the content.
- Use VisuallyHidden for context like "(opens in a new tab)".
Don't
- Don't hide focusable controls with VisuallyHidden.
- Don't point the skip link at an element without the id.