Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .changeset/eleven-radios-work.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@cloudflare/kumo": patch
---

fix(pagination): add ARIA attributes for screen reader accessibility

- Wrap pagination controls in `<nav>` for proper landmark navigation
- Add `aria-live="polite"` and `aria-atomic="true"` to status text for page change announcements
- Add `navigation` to `PaginationLabels` for i18n customization of the nav aria-label
52 changes: 0 additions & 52 deletions .changeset/pagination-a11y-i18n.md

This file was deleted.

9 changes: 7 additions & 2 deletions packages/kumo/src/components/pagination/pagination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ const clamp = (value: number, min: number, max: number) =>
* `label` prop on `Pagination.PageSize`.
*/
export interface PaginationLabels {
/** Aria label for the navigation landmark. @default "Pagination" */
navigation?: string;
/** Aria label for the first page button. @default "First page" */
firstPage?: string;
/** Aria label for the previous page button. @default "Previous page" */
Expand All @@ -50,6 +52,7 @@ export interface PaginationLabels {
}

const DEFAULT_LABELS: Required<PaginationLabels> = {
navigation: "Pagination",
firstPage: "First page",
previousPage: "Previous page",
nextPage: "Next page",
Expand Down Expand Up @@ -247,7 +250,7 @@ function PaginationControls({
data-slot="pagination-controls"
className={cn("grow flex flex-col items-end", className)}
>
<div>
<nav aria-label={labels.navigation}>
<InputGroup focusMode="individual">
{controls === "full" && (
<InputGroup.Button
Expand Down Expand Up @@ -346,7 +349,7 @@ function PaginationControls({
</InputGroup.Button>
)}
</InputGroup>
</div>
</nav>
</div>
);
}
Expand Down Expand Up @@ -596,6 +599,8 @@ function PaginationRoot(props: PaginationProps) {
className={cn("flex items-center gap-2 w-full", className)}
>
<div
aria-live="polite"
Comment thread
stritt marked this conversation as resolved.
aria-atomic="true"
data-slot="pagination-info"
className="grow text-sm text-kumo-strong"
>
Expand Down