Skip to content

Commit cab13b8

Browse files
authored
feat: improve accessibility (#775)
* 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
1 parent 9cfae99 commit cab13b8

File tree

4 files changed

+1
-8
lines changed

4 files changed

+1
-8
lines changed

src/TabNavList/OperationNode.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,6 @@ const OperationNode = React.forwardRef<HTMLDivElement, OperationNodeProps>((prop
202202
type="button"
203203
className={`${prefixCls}-nav-more`}
204204
style={moreStyle}
205-
tabIndex={-1}
206-
aria-hidden="true"
207205
aria-haspopup="listbox"
208206
aria-controls={popupId}
209207
id={`${id}-more`}

src/TabNavList/TabNode.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ const TabNode: React.FC<TabNodeProps> = props => {
126126
{removable && (
127127
<button
128128
type="button"
129+
role="tab"
129130
aria-label={removeAriaLabel || 'remove'}
130131
tabIndex={active ? 0 : -1}
131132
className={`${tabPrefix}-remove`}

tests/__snapshots__/index.test.tsx.snap

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,9 @@ exports[`Tabs.Basic Normal 1`] = `
7373
aria-controls="rc-tabs-test-more-popup"
7474
aria-expanded="false"
7575
aria-haspopup="listbox"
76-
aria-hidden="true"
7776
class="rc-tabs-nav-more"
7877
id="rc-tabs-test-more"
7978
style="visibility: hidden; order: 1;"
80-
tabindex="-1"
8179
type="button"
8280
>
8381
More
@@ -148,11 +146,9 @@ exports[`Tabs.Basic Skip invalidate children 1`] = `
148146
aria-controls="rc-tabs-test-more-popup"
149147
aria-expanded="false"
150148
aria-haspopup="listbox"
151-
aria-hidden="true"
152149
class="rc-tabs-nav-more"
153150
id="rc-tabs-test-more"
154151
style="visibility: hidden; order: 1;"
155-
tabindex="-1"
156152
type="button"
157153
>
158154
More

tests/__snapshots__/overflow.test.tsx.snap

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@ exports[`Tabs.Overflow should collapse 1`] = `
55
aria-controls="rc-tabs-test-more-popup"
66
aria-expanded="false"
77
aria-haspopup="listbox"
8-
aria-hidden="true"
98
class="rc-tabs-nav-more"
109
id="rc-tabs-test-more"
1110
style=""
12-
tabindex="-1"
1311
type="button"
1412
>
1513
More

0 commit comments

Comments
 (0)