Skip to content

Commit b5fc86f

Browse files
committed
fix: remove role="button" from li elements
role="button" on <li> inside <ul> violates axe aria-allowed-role and list rules, which breaks downstream a11y test suites (e.g. antd CI on every component rendering Pagination). Remove the invalid role while keeping all a11y improvements from #690: aria-label, aria-current, aria-disabled and keyboard activation.
1 parent a7dd4cb commit b5fc86f

5 files changed

Lines changed: 9 additions & 298 deletions

File tree

‎src/Pager.tsx‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ const Pager: React.FC<PagerProps> = (props) => {
6969
onClick={handleClick}
7070
onKeyDown={handleKeyPress}
7171
tabIndex={0}
72-
role="button"
7372
aria-label={pagerLabel}
7473
aria-current={active ? 'page' : undefined}
7574
>

‎src/Pagination.tsx‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,6 @@ const Pagination: React.FC<PaginationProps> = (props) => {
482482
[`${prefixCls}-jump-prev-custom-icon`]:
483483
isReactRenderable(jumpPrevIcon),
484484
})}
485-
role="button"
486485
aria-label={prevItemTitle}
487486
>
488487
{jumpPrevContent}
@@ -499,7 +498,6 @@ const Pagination: React.FC<PaginationProps> = (props) => {
499498
[`${prefixCls}-jump-next-custom-icon`]:
500499
isReactRenderable(jumpNextIcon),
501500
})}
502-
role="button"
503501
aria-label={nextItemTitle}
504502
>
505503
{jumpNextContent}
@@ -581,7 +579,6 @@ const Pagination: React.FC<PaginationProps> = (props) => {
581579
})}
582580
style={styles?.item}
583581
aria-disabled={prevDisabled}
584-
role="button"
585582
aria-label={locale.prev_page}
586583
>
587584
{prev}
@@ -611,7 +608,6 @@ const Pagination: React.FC<PaginationProps> = (props) => {
611608
})}
612609
style={styles?.item}
613610
aria-disabled={nextDisabled}
614-
role="button"
615611
aria-label={locale.next_page}
616612
>
617613
{next}

0 commit comments

Comments
 (0)