From c559371e289b4b24cfa85df92ddaa5feb0d8815f Mon Sep 17 00:00:00 2001 From: Zou Quan <2990918167@qq.com> Date: Mon, 1 Jun 2026 11:53:59 +0000 Subject: [PATCH 1/9] fix: improve pagination a11y semantics without locale fallback helper --- src/Pager.tsx | 14 +- src/Pagination.tsx | 61 +- tests/__snapshots__/demo.test.tsx.snap | 1494 ++++++++++++++++++---- tests/__snapshots__/simple.test.tsx.snap | 14 +- tests/index.test.tsx | 18 + 5 files changed, 1359 insertions(+), 242 deletions(-) diff --git a/src/Pager.tsx b/src/Pager.tsx index 0d1dcc4f..f56d6c78 100644 --- a/src/Pager.tsx +++ b/src/Pager.tsx @@ -6,6 +6,7 @@ import type { PaginationProps } from './interface'; export interface PagerProps extends Pick { rootPrefixCls: string; page: number; + pageLabel?: string; active?: boolean; className?: string; style?: React.CSSProperties; @@ -22,6 +23,7 @@ const Pager: React.FC = (props) => { const { rootPrefixCls, page, + pageLabel, active, className, style, @@ -50,7 +52,14 @@ const Pager: React.FC = (props) => { onKeyPress(e, onClick, page); }; - const pager = itemRender(page, 'page', {page}); + const pager = itemRender( + page, + 'page', + , + ); + const pagerLabel = `${pageLabel || 'Page'} ${page}`.trim(); return pager ? (
  • = (props) => { onClick={handleClick} onKeyDown={handleKeyPress} tabIndex={0} + role="button" + aria-label={pagerLabel} + aria-current={active ? 'page' : undefined} > {pager}
  • diff --git a/src/Pagination.tsx b/src/Pagination.tsx index 452203d4..38b459f3 100644 --- a/src/Pagination.tsx +++ b/src/Pagination.tsx @@ -116,12 +116,15 @@ const Pagination: React.FC = (props) => { function getItemIcon( icon: React.ReactNode | React.ComponentType, - label: string, + _label: string, + title?: string, ) { let iconNode = icon || (