When to use it#
- Use it under a list that continues on other pages: news, search results, a register of cases.
- Every page is a link to its own address, a path or a query. If paging doesn’t change the address, it is not pagination.
- You decide which numbers to show: keep the first and last page and those next to the current one, with an ellipsis (“…”) for each gap. Leave out Previous on the first page and Next on the last, never disable them.
- On a screen narrower than 40rem (640 pixels at the default text size) the theme shows only Previous, the current page, the status and Next. Always render
Pagination.Statustoo, so people on a phone see how many pages there are. From 40rem the total is the last page link, so keep it. - Not for steps in a form or a flow. Not for the sections of a site: use Navigation. Not for the way up the structure: use Breadcrumb.
Example#
import { Pagination } from '@kvirn-ui/react'
export function DefaultPagination() {
return (
<Pagination.Root>
<Pagination.List>
<Pagination.Item>
<Pagination.Previous href="#page-1" />
</Pagination.Item>
<Pagination.Item>
<Pagination.Link page={1} href="#page-1" />
</Pagination.Item>
<Pagination.Item>
<Pagination.Link page={2} href="#page-2" current />
</Pagination.Item>
<Pagination.Item>
<Pagination.Link page={3} href="#page-3" />
</Pagination.Item>
<Pagination.Item>
<Pagination.Status page={2} total={3} />
</Pagination.Item>
<Pagination.Item>
<Pagination.Next href="#page-3" />
</Pagination.Item>
</Pagination.List>
</Pagination.Root>
)
}Information: Implement like this
Register your router’s link once on the provider and every link here is rendered by it, so a click doesn’t reload the page. See the Next.js setup on KvirnProvider.
Use cases#
A news list with ten pages
With many pages, show the first and the last page and the pages around the current one. Put a Pagination.Ellipsis in each gap. A gap is its own item with the text …, so a screen reader counts it in the list and reads it as punctuation, or pauses. The page numbers around it show which pages are left out. Don’t hide it: an empty item is read as “blank”. To have it spoken as words, give Ellipsis your own text in a VisuallyHidden next to an aria-hidden …. It is not a link and not a Tab stop. The filled current page shows where you are, and on a narrow screen the status does too.
import { Pagination } from '@kvirn-ui/react'
import { usePaginationTexts } from './texts.ts'
export function NewsListPagination() {
const { texts } = usePaginationTexts()
return (
<Pagination.Root label={texts.newsLabel}>
<Pagination.List>
<Pagination.Item>
<Pagination.Previous href="#news-4" />
</Pagination.Item>
<Pagination.Item>
<Pagination.Link page={1} href="#news-1" />
</Pagination.Item>
<Pagination.Item>
<Pagination.Ellipsis />
</Pagination.Item>
<Pagination.Item>
<Pagination.Link page={4} href="#news-4" />
</Pagination.Item>
<Pagination.Item>
<Pagination.Link page={5} href="#news-5" current />
</Pagination.Item>
<Pagination.Item>
<Pagination.Link page={6} href="#news-6" />
</Pagination.Item>
<Pagination.Item>
<Pagination.Ellipsis />
</Pagination.Item>
<Pagination.Item>
<Pagination.Link page={10} href="#news-10" />
</Pagination.Item>
<Pagination.Item>
<Pagination.Status page={5} total={10} />
</Pagination.Item>
<Pagination.Item>
<Pagination.Next href="#news-6" />
</Pagination.Item>
</Pagination.List>
</Pagination.Root>
)
}Props in this example:
pageon Pagination.Linkcurrenton Pagination.Linkpageon Pagination.Statustotalon Pagination.Status
Information: Did you know?
The current page stays a link, so it is a Tab stop and its address can be copied. It has aria-current="page", which a screen reader announces itself, so its name stays “Page 5”. The digit people see is in the name (2.5.3 Label in Name, A).
Search results that keep the search
The library draws the links you give it and doesn’t count pages, so calculate the numbers from the current page and the total: the first and last page, the one before and after the current page, and an ellipsis where two or more pages are left out. Build every address from the search the visitor made, so Back, a copied link and a new tab open the same results.
import { Pagination } from '@kvirn-ui/react'
import { usePaginationTexts } from './texts.ts'
const currentPage = 7
const totalPages = 24
// The search the visitor made. In your service it comes from the address or the request.
const search = { q: 'extension', type: 'building-permit' }
// The library draws the links you give it and never counts pages. Show the first and last page,
// the page before and after the current one, and an ellipsis where two or more pages are left out.
// A gap of one page shows that page, because an ellipsis there would hide a single number.
function visiblePages(current: number, total: number): (number | 'gap')[] {
const shown = [...new Set([1, current - 1, current, current + 1, total])]
.filter((page) => page >= 1 && page <= total)
.sort((a, b) => a - b)
const items: (number | 'gap')[] = []
shown.forEach((page, index) => {
const before = shown[index - 1]
if (before !== undefined && page - before === 2) {
items.push(before + 1)
}
if (before !== undefined && page - before > 2) {
items.push('gap')
}
items.push(page)
})
return items
}
// Every address keeps the search words and the filter, so Back, a copied link and a new tab all
// open the same search on that page. The docs site starts it with `#` to stay on this page; in
// your service it starts with `?`.
function pageHref(page: number) {
return `#${new URLSearchParams({ ...search, page: String(page) }).toString()}`
}
export function SearchResultsPagination() {
const { texts } = usePaginationTexts()
return (
<Pagination.Root label={texts.searchLabel}>
<Pagination.List>
{currentPage > 1 ? (
<Pagination.Item>
<Pagination.Previous href={pageHref(currentPage - 1)} />
</Pagination.Item>
) : null}
{visiblePages(currentPage, totalPages).map((page, index) => (
<Pagination.Item key={page === 'gap' ? `gap-${index}` : page}>
{page === 'gap' ? (
<Pagination.Ellipsis />
) : (
<Pagination.Link page={page} href={pageHref(page)} current={page === currentPage} />
)}
</Pagination.Item>
))}
<Pagination.Item>
<Pagination.Status page={currentPage} total={totalPages} />
</Pagination.Item>
{currentPage < totalPages ? (
<Pagination.Item>
<Pagination.Next href={pageHref(currentPage + 1)} />
</Pagination.Item>
) : null}
</Pagination.List>
</Pagination.Root>
)
}Props in this example:
pageon Pagination.Linkcurrenton Pagination.Linkpageon Pagination.Statustotalon Pagination.Status
Information: Did you know?
A page is a URL, so a link that drops the search words or the filter opens a different list. Put them in every link, next to the page number.
The first page of a short list
On the first page there is no page before, so leave Previous out instead of disabling it. A link can’t be disabled, and a dimmed one would lead nowhere. Do the same with Next on the last page. With three pages there is no gap to mark.
import { Pagination } from '@kvirn-ui/react'
import { usePaginationTexts } from './texts.ts'
export function FirstPagePagination() {
const { texts } = usePaginationTexts()
return (
<Pagination.Root label={texts.firstLabel}>
<Pagination.List>
<Pagination.Item>
<Pagination.Link page={1} href="#case-1" current />
</Pagination.Item>
<Pagination.Item>
<Pagination.Link page={2} href="#case-2" />
</Pagination.Item>
<Pagination.Item>
<Pagination.Link page={3} href="#case-3" />
</Pagination.Item>
<Pagination.Item>
<Pagination.Status page={1} total={3} />
</Pagination.Item>
<Pagination.Item>
<Pagination.Next href="#case-2" />
</Pagination.Item>
</Pagination.List>
</Pagination.Root>
)
}Props in this example:
currenton Pagination.Link
Warning: Don't forget
Mark exactly one page as current, and list the pages in order, lowest first.
Your own words for the controls
Previous, Next and the status come from the library’s messages in five languages. To use other words, pass children, or override the message with messages on the part or on the provider. Say where the link leads, such as “Previous results”, and not just “Back” (2.4.4 Link Purpose (In Context), A).
import { Pagination } from '@kvirn-ui/react'
import { usePaginationTexts } from './texts.ts'
export function OwnWordsPagination() {
const { texts } = usePaginationTexts()
return (
<Pagination.Root label={texts.ownWordsLabel}>
<Pagination.List>
<Pagination.Item>
<Pagination.Previous href="#search-1">{texts.back}</Pagination.Previous>
</Pagination.Item>
<Pagination.Item>
<Pagination.Link page={1} href="#search-1" />
</Pagination.Item>
<Pagination.Item>
<Pagination.Link page={2} href="#search-2" current />
</Pagination.Item>
<Pagination.Item>
<Pagination.Link page={3} href="#search-3" />
</Pagination.Item>
<Pagination.Item>
<Pagination.Status page={2} total={3}>
{texts.status}
</Pagination.Status>
</Pagination.Item>
<Pagination.Item>
<Pagination.Next href="#search-3">{texts.forward}</Pagination.Next>
</Pagination.Item>
</Pagination.List>
</Pagination.Root>
)
}Props in this example:
Warning: Don't forget
Words you write are your own text. If their language differs from the page, put them in a nested KvirnProvider and spread useLocale().localeProps on your own element around them (3.1.2 Language of Parts, AA).
Two lists on one page
A case page can hold messages and documents, each with its own pages. Give each Pagination its own label, and put the page of both lists in every address, so paging one list leaves the other where it was.
Messages about your case
Documents in your case
import { Pagination } from '@kvirn-ui/react'
import { usePaginationTexts } from './texts.ts'
const messagePages = [1, 2, 3]
const documentPages = [1, 2, 3, 4]
const currentMessagePage = 2
const currentDocumentPage = 1
// Every address holds the page of both lists, so paging one list leaves the other where it was.
const pageHref = (messagePage: number, documentPage: number) =>
`#messages-${messagePage}-documents-${documentPage}`
export function TwoListsPagination() {
const { texts } = usePaginationTexts()
return (
<>
<p>{texts.messagesCaption}</p>
{/* Two paginations on a page need two names: with the default, a screen reader's list of
landmarks would show "Pages" twice. */}
<Pagination.Root label={texts.messagesLabel}>
<Pagination.List>
{currentMessagePage > 1 ? (
<Pagination.Item>
<Pagination.Previous href={pageHref(currentMessagePage - 1, currentDocumentPage)} />
</Pagination.Item>
) : null}
{messagePages.map((page) => (
<Pagination.Item key={page}>
<Pagination.Link
page={page}
href={pageHref(page, currentDocumentPage)}
current={page === currentMessagePage}
/>
</Pagination.Item>
))}
<Pagination.Item>
<Pagination.Status page={currentMessagePage} total={messagePages.length} />
</Pagination.Item>
{currentMessagePage < messagePages.length ? (
<Pagination.Item>
<Pagination.Next href={pageHref(currentMessagePage + 1, currentDocumentPage)} />
</Pagination.Item>
) : null}
</Pagination.List>
</Pagination.Root>
<p>{texts.documentsCaption}</p>
<Pagination.Root label={texts.documentsLabel}>
<Pagination.List>
{currentDocumentPage > 1 ? (
<Pagination.Item>
<Pagination.Previous href={pageHref(currentMessagePage, currentDocumentPage - 1)} />
</Pagination.Item>
) : null}
{documentPages.map((page) => (
<Pagination.Item key={page}>
<Pagination.Link
page={page}
href={pageHref(currentMessagePage, page)}
current={page === currentDocumentPage}
/>
</Pagination.Item>
))}
<Pagination.Item>
<Pagination.Status page={currentDocumentPage} total={documentPages.length} />
</Pagination.Item>
{currentDocumentPage < documentPages.length ? (
<Pagination.Item>
<Pagination.Next href={pageHref(currentMessagePage, currentDocumentPage + 1)} />
</Pagination.Item>
) : null}
</Pagination.List>
</Pagination.Root>
</>
)
}Props in this example:
Information: Did you know?
Without a label every Pagination is named by the message pagination.label (“Pages”), so a screen reader’s list of landmarks shows the same name twice.
Accessibility#
What it does for you#
- APG pattern: none. A labelled
<nav>around a list of links is plain HTML; the current page is marked witharia-current="page"as in GOV.UK and Designsystemet. - Deviations: none. Pages are URLs, so each is a link and none is a button: Back, sharing and opening in a new tab work.
- Native elements used:
<nav>(thenavigationlandmark),<ul>and<li>. The links are Link: native<a href>, rendered by the registered router link.
Pagination lets a resident move through a long list. It adds no tabindex, no key handling and no live announcement: the links are the focusable parts and own the keys. Which numbers and gaps to show is the consumer's.
| Part | Element / role | ARIA | Notes |
|---|---|---|---|
Pagination.Root | <nav> → navigation | aria-label from label or pagination.label | class="kv-pagination". Named, and distinct from the main navigation and the breadcrumb |
Pagination.List | <ul> → list | role="list" | The count of items is announced. 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) |
Pagination.Item | <li> → listitem | none | Holds one link, the gap or the status |
Pagination.Link | <a href> → link | aria-label Page N (none with your own children); aria-current="page" on the current one | A page: shows the number, named Page 2. current adds aria-current, which a screen reader announces itself, so the name does not repeat it. The visible number is in the name (2.5.3 Label in Name, A). Your own children replace the number and the aria-label, so the visible text is the name. It stays a link and a Tab stop |
Pagination.Previous | <a href> → link | none | Visible words Previous page, rel="prev". An arrow drawn by the theme is CSS content with an empty alternative |
Pagination.Next | <a href> → link | none | Visible words Next page, rel="next" |
Pagination.Ellipsis | <span> | none | The text … for a gap in the numbers, in its own list item, so the list's item count matches what is shown. Not a link, not focusable, not hidden from assistive technology. Screen readers read … by their punctuation setting ("dot dot dot", "ellipsis", or a pause). The page link names carry the gap as well. To speak words instead, pass children: <span aria-hidden="true">…</span> plus VisuallyHidden text from your messages |
Pagination.Status | <span> | none | Text such as Page 2 of 9. Shown with Previous, Next and the current page below 40rem, where the other numbers are hidden. Without it a narrow screen has no total (a development warning says so). From 40rem the total is the last page link, so keep it |
| Parts | as on the link parts only | none | The link parts are Link.Root wrappers with the same props, ref and as (as="a" bypasses the router). Root, List, Item, Ellipsis and Status have no as: the landmark and the list are fixed by the contract |
It announces nothing.
What you need to do#
- Every page is a URL (a query or a path), so Back, a bookmark and "open in new tab" work. No
onClickthat pages without changing the address. - Mark exactly one page
current, and list the page links in order. Keep the first and last page and the pages next to the current one, withPagination.Ellipsisfor each gap. - Previous and Next are omitted (not disabled) on the first and last page: a link can't be disabled, and a dimmed one would lead nowhere.
- Put it in the same place on every page that has a list, so people find it where they expect it.
- Render
Pagination.Statusas well so the narrow layout has its text: it is hidden by the theme from 40rem. - Language. A custom
childrenormessagesstring is your own: put it in a nestedKvirnProviderwithuseLocale().localePropson your own element if it differs from the page (3.1.2 Language of Parts, AA). Changing a visible label also changes its name (2.5.3 Label in Name, A). A page link with your ownchildrenhas noaria-label: the text you write is the name, so it must contain the visible name: an icon-only oraria-hidden-only child leaves the link unnamed. - Keep the look in a custom theme. See Visual / modes.
Warning: Don't forget
Always render Pagination.Status. Below 40rem the page numbers are hidden, so without it a phone shows no total. A development warning says so when it is missing (1.3.1 Info and Relationships, A).
Visual and modes#
- Focus indicator: a link shows the focus ring (
:focus-visible), throughLink. - Target size: 44 pixels high by default, 24 by 24 pixels at minimum (2.5.8 Target Size (Minimum), AA).
- Current page: a shape and
aria-current, never colour alone (1.4.1 Use of Color, A). - Reflow: the links wrap, and below 40rem only Previous, the current page, the status and Next show (1.4.10 Reflow, AA). The reflow sweep runs the narrow layout at 320 CSS px and fails on horizontal overflow.
- Forced colours and reduced motion: the links follow the system colours. In forced colours the fill drops and the current page shows a bar in the link colour under its number (checked by eye). The forced-colours sweep checks that each link has a visible boundary or distinct text and that the focus ring is drawn; the reduced-motion sweep checks that nothing animates.
A custom theme must keep these.
Focus management#
- Initial focus: not moved. Focus is never moved by the component. After a client-side navigation the consumer's route handling moves focus to the new content (2.4.3 Focus Order, A).
- Trap: no. Restore to: not applicable.
- A link shows the focus ring (
:focus-visible), throughLink.
Warning: Don't forget
When a page link shows new results without reloading the page, focus stays on the link you pressed and a screen reader says nothing. Move focus to the new content yourself, for example with Route focus (2.4.3 Focus Order, A).
WCAG success criteria#
1.3.1 Info and Relationships (A): a landmark and a list. 1.4.1 Use of Color (A): the current page is a filled shape and a weight, not colour. 1.4.10 Reflow (AA): the links wrap, and below 40rem only Previous, the current page, the status and Next show. 2.4.3 Focus Order (A). 3.2.3 Consistent Navigation (AA): the consumer rule to put it in the same place on every page. 2.4.4 Link Purpose (In Context) (A): Page 2. 2.5.3 Label in Name (A): the visible number is in the name. 2.5.8 Target Size (Minimum) (AA). 3.1.2 Language of Parts (AA): a custom label in another language is marked by the consumer. 4.1.2 Name, Role, Value (A). 2.4.8 Location (AAA, beyond the AA bar): the current page and the total show where you are. Designed and tested to meet WCAG 2.2 AA.
Keyboard#
- Focus
- native
- Selection follows focus
- n/a
- Arrows wrap
- n/a
- Shortcuts
- none
Native tab order. No key is intercepted, and the arrow keys do nothing.
| Key | Where | What happens |
|---|---|---|
| Tab | before / on the pages | Moves to the next link in order, the current page included. The ellipsis and status are not stops Test: pagination.test.tsx › Pagination keyboard › Tab moves through every link in order, and the ellipsis and status are no stops |
| Tab | on the current page | The current page is a link, so it is a Tab stop Test: pagination.test.tsx › Pagination keyboard › the current page is a link and a Tab stop |
| Shift+Tab | on a link | Moves to the previous link Test: pagination.test.tsx › Pagination keyboard › Shift+Tab moves to the previous link |
| Enter | on a link | Follows it: a router link navigates without a page load, and focus stays on the link Test: pagination.test.tsx › Pagination keyboard › Enter follows a link through the registered router link, without a page load |
| Space | on a link | Not handled (a link: the page scrolls natively) Test: pagination.test.tsx › Pagination keyboard › Space is not handled |
API reference#
import { Pagination, usePagination } from '@kvirn-ui/react'Pagination.Root
Renders <nav>, the navigation landmark, named by the message pagination.label or your label. 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 message pagination.label | The accessible name, from your translations. Set as aria-label. An empty or whitespace-only label counts as none. Name two paginations on one page differently. |
messages | Partial<KvirnMessages['pagination']> | – | Per-instance message overrides. |
| Class or attribute | Values | Meaning |
|---|---|---|
kv-pagination | always | The part class. The default theme styles it. |
aria-label | the name | Always set, from label or the message pagination.label. |
Pagination.List
Renders <ul> with the role list. Previous, the pages, the status and Next each go in a Pagination.Item.
| Class or attribute | Values | Meaning |
|---|---|---|
kv-pagination-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. |
Pagination.Item
Renders <li> with the role listitem. It holds one link, the gap or the status.
| Class or attribute | Values | Meaning |
|---|---|---|
kv-pagination-item | always | The part class. |
Pagination.Link
Renders <a href> for one page: a thin wrapper over Link.Root, so it is rendered by the router link you register on the provider. It takes the other props and ref of Link.Root, except current, which is a boolean here. Pass as="a" to skip the router link.
| Prop | Type | Default | Description |
|---|---|---|---|
page | number | Required | The page this link goes to, from 1. It is the link’s text, through the locale’s number format, and with the message its name: Page 2. |
current | boolean | false | This link is the current page. It stays a link, and gets aria-current="page" and the name Page 2 (the current state is aria-current, not repeated in the name). |
messages | Partial<KvirnMessages['pagination']> | – | Overrides pagination.page for this link. |
children | ReactNode | the page number | Your own text. It replaces the number and the aria-label, so the text you write is the link’s name. Keep it a real name: an icon alone leaves the link unnamed. |
| Class or attribute | Values | Meaning |
|---|---|---|
kv-pagination-link | always | The part class, next to kv-link. |
aria-label | "Page 2", or absent | From the message pagination.page. Not set when you give your own children. |
aria-current | "page" or absent | From current. |
Pagination.Previous
Renders <a href> to the previous page, with the words from the message pagination.previous. It takes the other props and ref of Link.Root.
| Prop | Type | Default | Description |
|---|---|---|---|
messages | Partial<KvirnMessages['pagination']> | – | Overrides pagination.previous for this link. |
children | ReactNode | the message pagination.previous | Your own text. Its language is yours to set. |
| Class or attribute | Values | Meaning |
|---|---|---|
kv-pagination-previous | always | The part class, next to kv-link. The theme draws the arrow. |
rel | "prev" | Always set. |
Pagination.Next
Renders <a href> to the next page, with the words from the message pagination.next. It takes the other props and ref of Link.Root.
| Prop | Type | Default | Description |
|---|---|---|---|
messages | Partial<KvirnMessages['pagination']> | – | Overrides pagination.next for this link. |
children | ReactNode | the message pagination.next | Your own text. Its language is yours to set. |
| Class or attribute | Values | Meaning |
|---|---|---|
kv-pagination-next | always | The part class, next to kv-link. The theme draws the arrow. |
rel | "next" | Always set. |
Pagination.Ellipsis
Renders <span> with the text “…”, for a gap in the page numbers. It is not a link and not focusable.
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | … | Your own text for the gap. |
| Class or attribute | Values | Meaning |
|---|---|---|
kv-pagination-ellipsis | always | The part class. |
Pagination.Status
Renders <span> with the text from pagination.status, such as “Page 2 of 9”. The default theme shows it, with Previous, Next and the current page, below 40rem, and hides it on wider screens, where the last page link gives the total.
| Prop | Type | Default | Description |
|---|---|---|---|
page | number | Required | The page you are on, from 1. |
total | number | Required | How many pages there are. |
messages | Partial<KvirnMessages['pagination']> | – | Overrides pagination.status for this status. |
children | ReactNode | the message pagination.status | Your own text. Its language is yours to set. |
| Class or attribute | Values | Meaning |
|---|---|---|
kv-pagination-status | always | The part class. The default theme shows it below 40rem, with Previous, Next and the current page, and hides it on wider screens. |
usePagination
Options
| Prop | Type | Default | Description |
|---|---|---|---|
label | string | the message pagination.label | The accessible name, set as aria-label. An empty label counts as none. |
messages | Partial<KvirnMessages['pagination']> | – | Per-instance message overrides: { next: "Next results" }. |
Result
| Prop | Type | Default | Description |
|---|---|---|---|
rootProps | PaginationRootPartProps | – | Spread on the <nav>: the class and aria-label. |
listProps | PaginationListPartProps | – | Spread on the <ul>: the class. |
itemProps | PaginationItemPartProps | – | Spread on every <li>: the class. |
ellipsisProps | PaginationEllipsisPartProps | – | Spread on the gap’s <span>: the class. |
statusProps | PaginationStatusPartProps | – | Spread on the status <span>: the class. |
label | string | – | The resolved name of the landmark. |
previousLabel | string | – | The message pagination.previous: the text of the Previous link. |
nextLabel | string | – | The message pagination.next: the text of the Next link. |
getPageLabel | (page: number) => string | – | The name of a page link: Page 2. The current page gets aria-current="page" instead of a longer name. |
getStatus | (page: number, total: number) => string | – | The status text: Page 2 of 9. |
Strings
These are the default texts in @kvirn-ui/i18n.
For your whole app, pass messages to KvirnProvider. For one Pagination, pass its messages prop.
pagination.label
The landmark’s accessible name, set as aria-label.
| Language | Default text |
|---|---|
| Svenska | Sidor |
| Suomi | Sivut |
| Norsk bokmål | Sider |
| Norsk nynorsk | Sider |
| English | Pages |
pagination.previous
The visible text of the Previous link.
| Language | Default text |
|---|---|
| Svenska | Föregående sida |
| Suomi | Edellinen sivu |
| Norsk bokmål | Forrige side |
| Norsk nynorsk | Førre side |
| English | Previous page |
pagination.next
The visible text of the Next link.
| Language | Default text |
|---|---|
| Svenska | Nästa sida |
| Suomi | Seuraava sivu |
| Norsk bokmål | Neste side |
| Norsk nynorsk | Neste side |
| English | Next page |
pagination.status
The status text, shown on a narrow screen instead of most page links.
| Language | Default text |
|---|---|
| Svenska | Sida 2 av 9 |
| Suomi | Sivu 2/9 |
| Norsk bokmål | Side 2 av 9 |
| Norsk nynorsk | Side 2 av 9 |
| English | Page 2 of 9 |
pagination.page
The name of a page link. The visible number stays in the name.
| Language | Default text |
|---|---|
| Svenska | Sida 2 |
| Suomi | Sivu 2 |
| Norsk bokmål | Side 2 |
| Norsk nynorsk | Side 2 |
| English | Page 2 |
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 | pagination.stories.tsx, every story, 4 themes |
| Markup and ARIA (roles, names, ids, states) | pass | n/a | pass | pagination.test.tsx › is a navigation landmark named by the message pagination.label; expectNoA11yViolations |
| Keyboard contract rows (Vitest browser) | pass | n/a | pass | 5 rows, each names a test (pagination.test.tsx › Pagination keyboard › Tab moves through every link in order, and the ellipsis and status are no stops) |
| Focus order and management | pass | n/a | pass | pagination.test.tsx asserts focus (toHaveFocus); first rule: Pagination keyboard › Tab moves through every link in order, and the ellipsis and status are no stops |
| 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 reaches Previous, each page number and Next once. The gap and the status text are not stops.
- The current page is announced as current, and its name still has the number.
- Press Enter on a page link: the list and the address change, and Back returns. Note where focus lands and whether you hear the change.
- The landmarks list shows Pagination with its own name, and two on a page differ.
- At 320px only Previous, the current page, "Page N of M" and Next show, with no sideways scroll.
- In forced colours the current page still stands out.