Skip to content

Commit

Permalink
feat: improve accessibility (#775)
Browse files Browse the repository at this point in the history
* feat: improve accessibility

* fix: remove unnecessary role attributes from tab-related buttons

* Revert "fix: remove unnecessary role attributes from tab-related buttons"

This reverts commit 4c68273.

* revert: restore role attribute for add button
  • Loading branch information
aojunhao123 authored Feb 7, 2025
1 parent 9cfae99 commit cab13b8
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 8 deletions.
2 changes: 0 additions & 2 deletions src/TabNavList/OperationNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,6 @@ const OperationNode = React.forwardRef<HTMLDivElement, OperationNodeProps>((prop
type="button"
className={`${prefixCls}-nav-more`}
style={moreStyle}
tabIndex={-1}
aria-hidden="true"
aria-haspopup="listbox"
aria-controls={popupId}
id={`${id}-more`}
Expand Down
1 change: 1 addition & 0 deletions src/TabNavList/TabNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ const TabNode: React.FC<TabNodeProps> = props => {
{removable && (
<button
type="button"
role="tab"
aria-label={removeAriaLabel || 'remove'}
tabIndex={active ? 0 : -1}
className={`${tabPrefix}-remove`}
Expand Down
4 changes: 0 additions & 4 deletions tests/__snapshots__/index.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,9 @@ exports[`Tabs.Basic Normal 1`] = `
aria-controls="rc-tabs-test-more-popup"
aria-expanded="false"
aria-haspopup="listbox"
aria-hidden="true"
class="rc-tabs-nav-more"
id="rc-tabs-test-more"
style="visibility: hidden; order: 1;"
tabindex="-1"
type="button"
>
More
Expand Down Expand Up @@ -148,11 +146,9 @@ exports[`Tabs.Basic Skip invalidate children 1`] = `
aria-controls="rc-tabs-test-more-popup"
aria-expanded="false"
aria-haspopup="listbox"
aria-hidden="true"
class="rc-tabs-nav-more"
id="rc-tabs-test-more"
style="visibility: hidden; order: 1;"
tabindex="-1"
type="button"
>
More
Expand Down
2 changes: 0 additions & 2 deletions tests/__snapshots__/overflow.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ exports[`Tabs.Overflow should collapse 1`] = `
aria-controls="rc-tabs-test-more-popup"
aria-expanded="false"
aria-haspopup="listbox"
aria-hidden="true"
class="rc-tabs-nav-more"
id="rc-tabs-test-more"
style=""
tabindex="-1"
type="button"
>
More
Expand Down

0 comments on commit cab13b8

Please sign in to comment.