diff --git a/src/Pager.tsx b/src/Pager.tsx index 0d1dcc4f..5a512afd 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}`.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 3ab4124b..53f0076c 100644 --- a/src/Pagination.tsx +++ b/src/Pagination.tsx @@ -6,6 +6,7 @@ import { warning, } from '@rc-component/util'; import React, { useEffect } from 'react'; +import isEnterOrSpaceKey from './isEnterOrSpaceKey'; import type { PaginationProps } from './interface'; import zhCN from './locale/zh_CN'; import Options from './Options'; @@ -116,12 +117,15 @@ const Pagination: React.FC = (props) => { function getItemIcon( icon: React.ReactNode | React.ComponentType, - label: string, + _label: string, + title?: string, ) { let iconNode = icon || (