Skip to content

Commit 19464a7

Browse files
committed
feat: improve accessibility
1 parent 9cfae99 commit 19464a7

File tree

5 files changed

+2
-8
lines changed

5 files changed

+2
-8
lines changed

src/TabNavList/AddButton.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const AddButton = React.forwardRef<HTMLButtonElement, AddButtonProps>((props, re
1818
<button
1919
ref={ref}
2020
type="button"
21+
role='tab'
2122
className={`${prefixCls}-nav-add`}
2223
style={style}
2324
aria-label={locale?.addAriaLabel || 'Add tab'}

src/TabNavList/OperationNode.tsx

-2
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

+1
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

-4
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

-2
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)