When to use it#
- Use it for the links that move people between the pages of a service or a site: a main menu, a section menu, or a menu beside a long guide.
- Give every navigation a name, and a different name when a page has more than one. A screen reader lists the page’s landmarks (labelled regions such as a navigation), and the name is how people tell two navigations apart.
- Keep it in the same place and the same order on every page, so people find it where they expect it (3.2.3 Consistent Navigation, AA).
- Keep to two levels on pages for residents. A sidebar for staff, or one from a content management system, can go deeper.
- Not for switching content on the same page: use Tabs. Not for the headings of one long page: use TableOfContents.
- Not for a menu with flyouts, or one that opens its own lists: see the Main menu pattern. Navigation has no flyouts and no toggle of its own. You can open and close a group yourself, as in “A group that opens and closes” below.
Example#
import { Link, Navigation } from '@kvirn-ui/react'
import { useNavigationTexts } from './texts.ts'
export function DefaultNavigation() {
const { texts } = useNavigationTexts()
return (
<Navigation.Root label={texts.labelMain}>
<Navigation.List>
<Navigation.Item>
<Link.Root href="#example" current="page">
{texts.overview}
</Link.Root>
</Navigation.Item>
<Navigation.Item>
<Link.Root href="#use-cases">{texts.apply}</Link.Root>
</Navigation.Item>
<Navigation.Item>
<Link.Root href="#api">{texts.contact}</Link.Root>
</Navigation.Item>
</Navigation.List>
</Navigation.Root>
)
}Warning: Don't forget
Write link text that says where the link goes, such as “Apply for a parking permit”, never “click here” (2.4.4 Link Purpose (In Context), A).
Use cases#
A section with a second level
A section has pages under it. Put a second Navigation.List inside the item they belong to. The lists nest as ordinary HTML lists, so a screen reader tells people which level they are on. Mark only the page you are on as current, never its parent.
import { Link, Navigation } from '@kvirn-ui/react'
import { useNavigationTexts } from './texts.ts'
export function TwoLevels() {
const { texts } = useNavigationTexts()
return (
<Navigation.Root label={texts.labelNested}>
<Navigation.List>
<Navigation.Item>
<Link.Root href="#example">{texts.overview}</Link.Root>
</Navigation.Item>
<Navigation.Item>
<Link.Root href="#use-cases">{texts.apply}</Link.Root>
<Navigation.List>
<Navigation.Item>
<Link.Root href="#two-levels" current="page">
{texts.resident}
</Link.Root>
</Navigation.Item>
<Navigation.Item>
<Link.Root href="#horizontal">{texts.visitor}</Link.Root>
</Navigation.Item>
</Navigation.List>
</Navigation.Item>
<Navigation.Item>
<Link.Root href="#api">{texts.contact}</Link.Root>
</Navigation.Item>
</Navigation.List>
</Navigation.Root>
)
}Information: Did you know?
The parent of the current page is drawn as a quiet bold trail, but it is not announced. The nesting of the lists tells screen reader users where they are.
A row of sections at the top
Add the class kv-navigation--horizontal to the root to lay the top level out as a row that wraps. It changes the look only. The roles, the names and the keys are the same as in a column, and the links stay in reading order. A row has one level: a nested list stays a column under its item.
import { Link, Navigation } from '@kvirn-ui/react'
import { useNavigationTexts } from './texts.ts'
export function HorizontalNavigation() {
const { texts } = useNavigationTexts()
return (
<Navigation.Root label={texts.labelHorizontal} className="kv-navigation--horizontal">
<Navigation.List>
<Navigation.Item>
<Link.Root href="#horizontal" current="page">
{texts.parking}
</Link.Root>
</Navigation.Item>
<Navigation.Item>
<Link.Root href="#use-cases">{texts.waste}</Link.Root>
</Navigation.Item>
<Navigation.Item>
<Link.Root href="#api">{texts.roads}</Link.Root>
</Navigation.Item>
</Navigation.List>
</Navigation.Root>
)
}When the page isn’t in the navigation
Some pages are not in the menu, such as one application. Put current, with no value, on the deepest item the menu does show. It sets aria-current to true, so the menu still has exactly one current link.
import { Link, Navigation } from '@kvirn-ui/react'
import { useNavigationTexts } from './texts.ts'
export function PageNotListed() {
const { texts } = useNavigationTexts()
return (
<Navigation.Root label={texts.labelNotListed}>
<Navigation.List>
<Navigation.Item>
<Link.Root href="#example">{texts.overview}</Link.Root>
</Navigation.Item>
<Navigation.Item>
<Link.Root href="#page-not-listed">{texts.applications}</Link.Root>
<Navigation.List>
<Navigation.Item>
<Link.Root href="#use-cases" current>
{texts.applicationsOpen}
</Link.Root>
</Navigation.Item>
<Navigation.Item>
<Link.Root href="#api">{texts.applicationsDecided}</Link.Root>
</Navigation.Item>
</Navigation.List>
</Navigation.Item>
</Navigation.List>
</Navigation.Root>
)
}Warning: Don't forget
Mark exactly one link per navigation, and never an ancestor of a listed page. Two current links confuse a screen reader user, and a development warning fires (4.1.2 Name, Role, Value, A).
A group that opens and closes
Navigation has no toggle of its own. Render the group with hidden and open it from a Button with aria-expanded and aria-controls. The links of a hidden group leave the Tab order, so keyboard users skip them until the group is open. Never put current on a link inside a hidden group.
import { Button, Link, Navigation } from '@kvirn-ui/react'
import { useId, useState } from 'react'
import { useNavigationTexts } from './texts.ts'
export function CollapsibleGroup() {
const { texts } = useNavigationTexts()
const [isOpen, setIsOpen] = useState(false)
const groupId = useId()
return (
<Navigation.Root label={texts.labelCollapsible}>
<Navigation.List>
<Navigation.Item>
<Link.Root href="#collapsible-group" current="page">
{texts.overview}
</Link.Root>
</Navigation.Item>
<Navigation.Item>
<Button aria-expanded={isOpen} aria-controls={groupId} onClick={() => setIsOpen(!isOpen)}>
{texts.permitTypes}
</Button>
<Navigation.List id={groupId} hidden={!isOpen}>
<Navigation.Item>
<Link.Root href="#two-levels">{texts.resident}</Link.Root>
</Navigation.Item>
<Navigation.Item>
<Link.Root href="#horizontal">{texts.visitor}</Link.Root>
</Navigation.Item>
</Navigation.List>
</Navigation.Item>
</Navigation.List>
</Navigation.Root>
)
}Information: Implement like this
Hide the group, never unmount it, so the button’s aria-controls still points at it.
<Button aria-expanded={isOpen} aria-controls={groupId} onClick={toggle}>
{permitTypes}
</Button>
<Navigation.List id={groupId} hidden={!isOpen}>…</Navigation.List>Links grouped under labels
A staff sidebar groups its links under names such as Permits and Services. Put a Navigation.Label in each item, next to its nested list. The list takes the label as its name, so people using a screen reader hear which group they are in. The label is plain text, not a heading and not a link. The browser adds the name after the page loads, so it is not in the HTML the server sends.
import { Link, Navigation } from '@kvirn-ui/react'
import { useNavigationTexts } from './texts.ts'
export function GroupLabels() {
const { texts } = useNavigationTexts()
return (
<Navigation.Root label={texts.labelGroups}>
<Navigation.List>
<Navigation.Item>
<Navigation.Label>{texts.groupPermits}</Navigation.Label>
<Navigation.List>
<Navigation.Item>
<Link.Root href="#group-labels" current="page">
{texts.resident}
</Link.Root>
</Navigation.Item>
<Navigation.Item>
<Link.Root href="#two-levels">{texts.visitor}</Link.Root>
</Navigation.Item>
</Navigation.List>
</Navigation.Item>
<Navigation.Item>
<Navigation.Label>{texts.groupServices}</Navigation.Label>
<Navigation.List>
<Navigation.Item>
<Link.Root href="#horizontal">{texts.waste}</Link.Root>
</Navigation.Item>
<Navigation.Item>
<Link.Root href="#api">{texts.roads}</Link.Root>
</Navigation.Item>
</Navigation.List>
</Navigation.Item>
</Navigation.List>
</Navigation.Root>
)
}Accessibility#
What it does for you#
- APG pattern: none needed for a list of links. A labelled
<nav>landmark around a list of links is plain HTML, and it is not the Disclosure Navigation pattern: nothing here opens or closes. Neverrole="menu". - Deviations: none
- Native elements used:
<nav>(thenavigationlandmark),<ul>and<li>. The links are Link: native<a href>.
Navigation is a named landmark around a list of page links, with the current page marked and an optional second level. It adds no tabindex, no key handling, no state and no announcement: the links are the focusable parts and own the keys (link.a11y.md). It is not a composite widget, so every link is a Tab stop and the arrow keys do nothing. It is a vertical list by default and a row that wraps with the class kv-navigation--horizontal on the root. Orientation is a look and not behaviour, so it is a class and not a prop, and it changes no role, key or name.
| Part | Element / role | ARIA | Notes |
|---|---|---|---|
| Navigation.Root | <nav> → navigation landmark | aria-label from label, or the consumer's aria-labelledby | class="kv-navigation". A name is required (2.4.1 Bypass Blocks, A; 2.4.6 Headings and Labels, AA): label, or aria-labelledby pointing at a visible heading, which is preferred where a heading exists. Also exported as NavigationRoot |
| Navigation.List | <ul> → list | role="list" | class="kv-navigation-list". A nested Navigation.List inside an Navigation.Item is a native nested list, so the level and the count are announced (1.3.1 Info and Relationships, A). The explicit role="list" keeps the list announced in Safari/VoiceOver, which drops it from a list with list-style: none (1.3.1 Info and Relationships, A). Also exported as NavigationList |
| Navigation.Item | <li> → listitem | none | class="kv-navigation-item". Holds a Link, and optionally a nested Navigation.List. Also exported as NavigationItem |
| Navigation.Label | <span>, plain text, no role | the nested Navigation.List in the same item gets aria-labelledby with the label's id | class="kv-navigation-label". A group's name: the list is announced by it, for example "Components", list, 3 items (1.3.1 Info and Relationships, A; 4.1.2 Name, Role, Value, A). Not a heading, not a link, no tabindex, no handler. A list's own aria-label or aria-labelledby wins. The label registers in an effect, so the name is set on hydration and not in server HTML. Development warnings fire for a label with no nested list in its item, and for a label outside any item. Also exported as NavigationLabel. Tests: navigation.test.tsx › Navigation.Label |
| the link in an item | Link.Root → link | aria-current from current on the Link | Owned by Link (link.a11y.md). Exactly one link per navigation has it: "page" when the page is listed, otherwise "true" (current with no value) on the deepest item shown. Never on an ancestor of a listed page, and never on a link inside a hidden group. The default theme draws it as a solid fill in bold text, so it is never shown by colour alone (1.4.1 Use of Color, A) |
| the ancestors of the current link (trail) | the same links | none | Visual only: a quiet fill and bold text, found by the theme's CSS, so there is nothing to mark. Not announced, and never aria-current: ARIA allows one current item per set, and the nesting of the lists carries the hierarchy for assistive technology |
Navigation.List with hidden | <ul hidden> | the consumer's hidden attribute | A group you collapse is rendered with hidden and never unmounted: its links leave the Tab sequence and the accessibility tree, and the default theme keeps it collapsed without reset.css. The toggle that opens it is the consumer's. Test: navigation.test.tsx › Tab skips a collapsed group |
| Navigation.Root with the horizontal class | className="kv-navigation--horizontal" | none | A look: the top level in a row that wraps. No aria-orientation and no arrow keys. Every link is still a Tab stop in DOM order, and there is no orientation prop |
| List, Label | as | the element's own | Allowed elements: List ul (default) or ol; Label span (default) or p. Another tag warns once in development and falls back to the default. Root (<nav>) and Item (<li>) have no as: the landmark and the list item are fixed. The part's props are merged in: className joins, style merges, refs merge |
| every part | attributes | passed through | id, hidden, data-*, aria-* reach the element. The part's class is its own: a className prop joins it, never replace it |
| every part | never | no role other than the list's (the elements have it), no tabindex, no aria-hidden | No click handler, no heading, no live region, no text. label is the only string, and it is the consumer's |
| Root | no name | – | Development warning. An empty or whitespace-only label counts as no name |
| Root | another nav landmark with the same name | – | Development warning, once per name. Any <nav> or role="navigation" on the page counts, not only Navigation's |
| Root | more than one link with aria-current | – | Development warning, once per name, checked after the page renders (4.1.2 Name, Role, Value, A; 1.3.1 Info and Relationships, A). Every aria-current other than "false" counts, a nested link and a link inside a hidden group too. Tests: navigation.test.tsx › development warnings |
useNavigation({ label }) gives the same rootProps (class and aria-label), listProps and itemProps for your own elements.
It announces nothing.
What you need to do#
- Name every navigation, and give each a different name (2.4.1 Bypass Blocks, A; 2.4.6 Headings and Labels, AA): "Main menu", "In this section". Prefer
aria-labelledbypointing at a visible heading where there is one. Don't put "navigation" or "menu" in the label when the landmark role already says it, unless the name would be empty without it. - Render the same items in the same order and the same place on every page. Navigation never reorders items, so keep the list the same from page to page.
- Mark exactly one current link per navigation (4.1.2 Name, Role, Value, A).
current="page"goes on the link to the page. When the page isn't in the navigation (a case page, a menu that stops above it, a header bar of sections),currentwith no value goes on the deepest item shown, which givesaria-current="true"(the GOV.UK Design System calls it the active item). Never on an ancestor of a listed page, and never on a link inside ahiddengroup: when the page is inside a collapsed group, the deepest item shown takes it. Navigation doesn't detect the page from the router, and a development warning fires when two links have it. - Collapse a group with
hidden, never by unmounting it. Its links stay in the DOM but leave the Tab sequence and the accessibility tree. The toggle that opens it is yours (aButtonwitharia-expandedandaria-controls): Navigation has no toggle and does not manage a disclosure. - A horizontal bar is one level. A nested list stays a column under its item. Give a section's sub-links a second
Navigationwith its own name. Navigation has no flyouts and no collapsing of its own. - Link text says where the link goes, in context (2.4.4 Link Purpose (In Context), A). No "click here".
- Two levels at most on resident pages. A staff or CMS sidebar may go deeper, with the trail showing the way. A menu that opens and closes is not a longer list: build the toggle yourself, as above.
- A group label is a
Navigation.Labelin theNavigation.Item, next to the nested list it names, with text from your own translations. Don't use a heading or a fake link for it. There is noNavigation.Grouppart. - Don't wrap a link in anything focusable. Each item holds one link and an optional nested list.
- Skip link and landmark order belong to the page, not the component (2.4.1 Bypass Blocks, A).
Warning: Don't forget
Give every navigation a name, and a different one on each. A screen reader user picks a landmark by its name. Where a visible heading exists, point aria-labelledby at it. A development warning fires if a name is missing or used twice (2.4.1 Bypass Blocks, A; 2.4.6 Headings and Labels, AA).
Visual and modes#
Headless: Navigation ships no CSS. With @kvirn-ui/theme/theme.css:
- Focus indicator: the link's focus ring, at least 2 pixels thick with 3:1 contrast, outside the item (2.4.7 Focus Visible, AA; 2.4.13 Focus Appearance, AAA). Around the solid fill the offset band is what tells the ring from the fill. A story asserts the ring on the current page.
- Target size: every item is at least 24 by 24 CSS pixels, in a list and in a bar, also in compact density, which helps touch and tremor users (2.5.8 Target Size (Minimum), AA). Stories assert that threshold for a list, a bar and compact density.
- Current page: a solid fill with a label that contrasts with it, in bold text. The fill is a shape at 3:1 or more against the surface, and bold against regular is a second cue, so it is never shown by colour alone (1.4.1 Use of Color, A). The trail, every ancestor of it, is a quiet fill in bold text. Everything else is regular text with no fill, and an underline on hover and press.
- Forced colours: the fills drop (the system's background colour, with its link colour for labels). The current item gets a straight bar in the system's link colour, never a border on the rounded box: at the inline start of a list item and under the label in a horizontal bar. The trail keeps bold text. The forced-colours sweep checks that every link keeps a visible boundary and shows a focus indicator when it has focus; the bold cue itself is not checked automatically.
- Group label: small type in the muted text colour, at every density, aligned with the links' text, with space above it from the second item on. The muted text colour on the surface is already measured for contrast (1.4.3 Contrast (Minimum), AA). Forced colours: the system's text colour.
- Contrast: every colour pair meets its minimum, checked automatically in every theme (1.4.3 Contrast (Minimum), AA, 4.5:1 for text; 1.4.11 Non-text Contrast, AA, 3:1): the label on the current fill, text on the trail fill, text on the plain backgrounds for the hover underline, and the fill against the page background, a surface and a raised surface.
- reduced-motion behaviour: the link's colour, underline and background transition only under
prefers-reduced-motion: no-preference. - RTL: logical properties only. The nested indent and the forced-colours bar sit at the inline start (the right), and a horizontal bar starts at the right.
- Horizontal (
kv-navigation--horizontal): the top level is a row that wraps with gaps between items. Each item is as wide as its label, up to the row, so a longer label wraps inside its item. One level: a nested list stays an indented column under its item. - Collapsed groups: a
hiddengroup isdisplay: none, so it stays collapsed withoutreset.css. - Reflow and text spacing: a vertical list by default and a row that wraps in a bar, so long words break. No horizontal scrolling at 320 CSS pixels wide, vertical and horizontal (1.4.10 Reflow, AA): the reflow sweep runs every story at 320 CSS px, with long Finnish text, and fails on horizontal overflow. The text-spacing sweep applies the 1.4.12 spacing and fails on a box that clips its content.
Focus management#
- Initial focus: not moved. Navigation never moves focus.
- Trap: no. Tab always leaves the navigation.
- Restore to: not applicable. Where focus goes after a link is followed is the router's or the app's job (for example, to the new page's
h1). - Never obscured by: Navigation renders no overlay and sets no
overflow, so a link's focus ring is never clipped (2.4.11 Focus Not Obscured (Minimum), AA; 2.4.13 Focus Appearance, AAA). In a horizontal bar the gaps keep one item's ring clear of the next item's fill.
WCAG success criteria#
- 1.3.1 Info and Relationships (A): a
<nav>landmark, native lists and nesting (navigation.test.tsx › renders a named navigation landmark with a list of list items,› a nested list sits inside an item, so the level is announced). The trail is visual, and the list nesting carries the hierarchy. - 1.4.1 Use of Color (A): the current page is a fill and bold text, and the trail is bold text (default theme). In forced colours the current page is a bar and bold text, and the trail is bold text.
- 1.4.3 Contrast (Minimum) (AA), 1.4.11 Non-text Contrast (AA): the theme's contrast check on every colour pair.
- 1.4.10 Reflow (AA), 1.4.12 Text Spacing (AA): the Finnish fixtures at 320 pixels wide, vertical and horizontal,
overflow-wrap, no fixed heights or widths. - 2.4.1 Bypass Blocks (A), 2.4.6 Headings and Labels (AA): a named landmark and a named group (
Navigation.Label), with a development warning for no name and for a duplicate name (navigation.test.tsx › development warnings). - 2.1.1 Keyboard (A), 2.4.3 Focus Order (A): native links in DOM order, and a
hiddengroup skipped (the Keyboard rows above). - 2.4.4 Link Purpose (In Context) (A): the consumer's link text.
- 2.4.7 Focus Visible (AA): the link ring. 2.4.11 Focus Not Obscured (Minimum) (AA): nothing covers or clips it. 2.4.13 Focus Appearance (AAA, beyond the AA bar): the ring's size and contrast.
- 2.5.8 Target Size (Minimum) (AA): the 24 pixel threshold in the compact and horizontal stories.
- 4.1.2 Name, Role, Value (A): the landmark's name, and exactly one
aria-currentper navigation, with a development warning for two (navigation.test.tsx › development warnings).
Keyboard#
- Focus
- native
- Selection follows focus
- n/a
- Arrows wrap
- n/a
- Shortcuts
- none
Each link is a native <a href> and its own Tab stop, in DOM order, which is also the visual order: in a horizontal bar too, where right to left the order starts at the right. There is no roving tabindex and no arrow-key navigation: this is a list of links, not a menu. The links own Enter (link.a11y.md). Navigation never moves focus. A group rendered with hidden is out of the Tab sequence.
| Key | Where | What happens |
|---|---|---|
| Tab | before or in the navigation | Moves to the next link, nested links in DOM order included, then out of the nav Test: navigation.test.tsx › Tab moves through the links in DOM order, nested ones included |
| Tab | a group rendered with hidden | Skips it: its links are not Tab stops Test: navigation.test.tsx › Tab skips a collapsed group |
| Tab | a group's label | The label is no Tab stop: focus goes from the link before it to the first link of its list Test: navigation.test.tsx › the label is no Tab stop: Tab goes from link to link past it |
| Shift+Tab | on a link | Moves to the previous link, then out of the navigation Test: navigation.test.tsx › Shift+Tab moves back through the links, then out of the navigation |
| Enter | on a link | Follows the link Test: navigation.test.tsx › Enter follows the link |
| ArrowUp / ArrowDown / ArrowLeft / ArrowRight / Home / End | on a link | Arrow keys, Home and End are not handled: focus stays on the link Test: navigation.test.tsx › Arrow keys, Home and End are not handled |
Space, Escape and the arrow keys are not handled. Space scrolls the page, as on any link. A horizontal bar has the same keys: Left and Right do nothing there either.
API reference#
import { Navigation, useNavigation } from '@kvirn-ui/react'Navigation.Root
Renders <nav>, the navigation landmark. It takes every attribute of a <nav> and passes ref to it. The default theme is described on Theming.
| Prop | Type | Default | Description |
|---|---|---|---|
label | string | – | The accessible name, from your translations. Set as aria-label. Where a visible heading names it, leave it out and pass aria-labelledby instead. |
| Class or attribute | Values | Meaning |
|---|---|---|
kv-navigation | always | The part class. The default theme styles it. |
kv-navigation--horizontal | class you add | The top level as a row that wraps. A look only: the keys and roles don’t change. |
aria-label | the label, or absent | From label. Not set when you pass aria-labelledby. |
Navigation.List
Renders <ul> with the role list. Put another one inside a Navigation.Item for a second level.
| Prop | Type | Default | Description |
|---|---|---|---|
as | 'ul' | 'ol' | 'ul' | Changes the element. Use ol when the order is the meaning. Another tag warns once in development and falls back to ul. |
| Class or attribute | Values | Meaning |
|---|---|---|
kv-navigation-list | always | The part class. |
role | "list" | Always set. Safari with VoiceOver drops the list role from a list without markers, so it is written out. |
aria-labelledby | the id of a Navigation.Label, or yours | Set from the Navigation.Label in the same item, unless you pass aria-label or aria-labelledby yourself. |
hidden | present or absent | Yours. A group you collapse is rendered with hidden: its links leave the Tab order and the accessibility tree. |
Navigation.Item
Renders <li> with the role listitem. It holds a Link and, optionally, a nested Navigation.List.
| Class or attribute | Values | Meaning |
|---|---|---|
kv-navigation-item | always | The part class. |
Navigation.Label
Renders <span> with plain text, in the Navigation.Item next to the nested Navigation.List it names. It is not a heading and not a link: it has no role, is never a Tab stop and is not in the list of headings. Without a nested list in the same item it names nothing, and a development warning says so. A label outside any item gets a warning too.
| Prop | Type | Default | Description |
|---|---|---|---|
as | 'span' | 'p' | 'span' | Changes the element. It stays a name, never a heading. Another tag warns once in development and falls back to span. |
| Class or attribute | Values | Meaning |
|---|---|---|
kv-navigation-label | always | The part class. |
id | generated, or yours | What the nested Navigation.List points at with aria-labelledby. The list gets it when it has no aria-label or aria-labelledby of its own, and only after the page hydrates. |
useNavigation
Options
| Prop | Type | Default | Description |
|---|---|---|---|
label | string | – | The accessible name, set as aria-label. An empty label counts as none. |
Result
| Prop | Type | Default | Description |
|---|---|---|---|
rootProps | NavigationRootPartProps | – | Spread on the <nav>: the class and aria-label. |
listProps | NavigationListPartProps | – | Spread on every <ul>, nested ones too: the class. |
itemProps | NavigationItemPartProps | – | Spread on every <li>: the class. |
labelProps | NavigationLabelPartProps | – | Spread on your own group label: the class. Give the label an id and point your list’s aria-labelledby at it yourself. |
Known issues#
- List semantics in Safari. The default theme draws no list marker, and Safari (VoiceOver) drops the list semantics of such a list, so the lists carry
role="list". Check that VoiceOver in Safari says "list, 4 items" and announces the nested level. - The trail is visual only. The ancestors of the current page are drawn as a quiet bold trail, but never marked with
aria-currentand not announced. A screen reader user gets the hierarchy from the list nesting, and a Breadcrumb is the announced path. Check how well the nesting reads with your own screen reader. - A solid fill can be read as keyboard focus. A Listbox's active option and a pressed Toggle are solid in the primary colour too. The ring sits outside the fill, set off by a gap, so the two can be told apart. Test it with your users.
- Two solid fills at once. A header bar whose section carries
current(aria-current="true") next to a list whose page carries"page"draws two solid items. A bar has no second row for the trail branch either: give the section's sub-links a secondNavigation. - The trail's speed on very large trees is not measured. The theme finds the trail with a CSS selector that looks at the children of each item, and a very large CMS tree could make it slow.
- Keyboard tests run in Chromium only. The keyboard rows run in Vitest browser mode on Chromium, not in WebKit. Test in Safari with your own assistive technology.
- The group's name is set after hydration.
Navigation.Labelregisters in a layout effect, so the nested list getsaria-labelledbyon the client and not in the server HTML. Without JavaScript the list has no name, though the label text still comes before it in reading order.
Information: Did you know?
Check each item against your own site. What applies belongs in your accessibility statement, with the workaround. The Web Accessibility Directive requires public bodies to publish one.
Testing#
The automated tests prove the keyboard behaviour, the names and states, that axe finds no violations in every story and theme, and, for the components they cover, that the stories hold up in forced colours, reduced motion, text spacing and a 320 pixel width. An Automated row passes on these tests alone. A Core or Release row passes only when an automated agent check and a person on the real assistive technology have both checked it. "agent-verified" means automated tests in the repository (with a virtual screen reader for the screen reader rows), not the real assistive technology.
| AT + browser + OS | Agent check | Human check | Result | Notes |
|---|---|---|---|---|
| Automated (re-runnable tests) | ||||
| axe, WCAG 2.2 A and AA, every story, 4 themes | pass | n/a | pass | navigation.stories.tsx, every story, 4 themes |
| Markup and ARIA (roles, names, ids, states) | pass | n/a | pass | navigation.test.tsx › renders a named navigation landmark with a list of list items; expectNoA11yViolations |
| Keyboard contract rows (Vitest browser) | pass | n/a | pass | 6 rows, each names a test (navigation.test.tsx › Tab moves through the links in DOM order, nested ones included) |
| Focus order and management | pass | n/a | pass | navigation.test.tsx asserts focus (toHaveFocus); first rule: Tab moves through the links in DOM order, nested ones included |
| Display modes (forced colours, 320px reflow, text spacing, reduced motion) | pass | n/a | pass | the four sweep projects (storybook-forced-colors, -reduced-motion, -reflow, -text-spacing), run in CI |
| Core (required for beta) | ||||
| NVDA + Chrome + Windows | pending | pending | pending | |
| VoiceOver + Safari + iOS | pending | pending | pending | |
| Release (before 1.0 and each minor) | ||||
| JAWS + Chrome + Windows | pending | pending | pending | |
| TalkBack + Chrome + Android | pending | pending | pending | |
| VoiceOver + Safari + macOS | pending | pending | pending |
What to check#
With a screen reader and the keyboard, try:
- Tab through the navigation: each link is focused once, in reading order, with a visible ring.
- The landmarks list shows the navigation with its own name, and two navigations differ.
- The current page's link is announced as current, and its parent is not.
- A nested list is announced as a list with its item count (check Safari with VoiceOver too).
- A closed group's links are skipped by Tab. After opening the group they are reachable.
- At 400% zoom or 320px nothing scrolls sideways.