domestic-ui GitHub

Pagination

Links to the pages of a long list of results.

Our choice: No standard exists: a labelled <nav> with a list of links and aria-current="page", as for breadcrumbs.

Where pagination is used Pagination is the row of page links under a long list of results, with the current page marked.

Live example

Middle of a long list

<nav aria-label="Pagination" data-pagination>
  <ul>
    <li><a href="?page=4" rel="prev">Previous<span class="visually-hidden"> page</span></a></li>
    <li><a href="?page=1"><span class="visually-hidden">Page </span>1</a></li>
    <li aria-hidden="true">…</li>
    <li><a href="?page=4"><span class="visually-hidden">Page </span>4</a></li>
    <li><a href="?page=5" aria-current="page"><span class="visually-hidden">Page </span>5</a></li>
    <li><a href="?page=6"><span class="visually-hidden">Page </span>6</a></li>
    <li aria-hidden="true">…</li>
    <li><a href="?page=10"><span class="visually-hidden">Page </span>10</a></li>
    <li><a href="?page=6" rel="next">Next<span class="visually-hidden"> page</span></a></li>
  </ul>
</nav>

First page

<nav aria-label="Pagination, search results" data-pagination>
  <ul>
    <li><a>Previous<span class="visually-hidden"> page</span></a></li>
    <li><a href="?page=1" aria-current="page"><span class="visually-hidden">Page </span>1</a></li>
    <li><a href="?page=2"><span class="visually-hidden">Page </span>2</a></li>
    <li><a href="?page=3"><span class="visually-hidden">Page </span>3</a></li>
    <li><a href="?page=2" rel="next">Next<span class="visually-hidden"> page</span></a></li>
  </ul>
</nav>

Attributes

Attribute or valueWhereEffect
data-pagination<nav aria-label="Pagination">
aria-current="page"the current page link (native ARIA)
<a> without hrefa disabled Previous or Next (native placeholder link)
<li aria-hidden="true">…</li>a gap in the page numbers

Keyboard

KeyAction
Tabmoves to the next page link / Shift+Tab: previous
Enterfollows the focused link

Accessibility

  • A visually hidden "Page" completes each number's link name (WCAG 2.4.4).
  • At the ends, Previous or Next is an <a> with no href: not focusable.
  • Our choice: the current page stays a link with aria-current="page", so the list count stays stable.

Specifications

See also

How other systems do it

For comparison only; these are not the standard this system follows.

Search