Skip to content

Commit b2d241f

Browse files
authored
fix: search input a11y issues (#971)
1 parent ca60d43 commit b2d241f

File tree

6 files changed

+18
-1
lines changed

6 files changed

+18
-1
lines changed

src/Selector/Input.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ const Input: React.RefForwardingComponent<InputRef, InputProps> = (
9090
className: classNames(`${prefixCls}-selection-search-input`, inputNode?.props?.className),
9191

9292
role: 'combobox',
93+
'aria-label': 'Search',
9394
'aria-expanded': open,
9495
'aria-haspopup': 'listbox',
9596
'aria-owns': `${id}_list`,

tests/__snapshots__/Combobox.test.tsx.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ exports[`Select.Combobox renders controlled correctly 1`] = `
1515
aria-controls="rc_select_TEST_OR_SSR_list"
1616
aria-expanded="false"
1717
aria-haspopup="listbox"
18+
aria-label="Search"
1819
aria-owns="rc_select_TEST_OR_SSR_list"
1920
autocomplete="off"
2021
class="rc-select-selection-search-input"
@@ -48,6 +49,7 @@ exports[`Select.Combobox renders correctly 1`] = `
4849
aria-controls="rc_select_TEST_OR_SSR_list"
4950
aria-expanded="false"
5051
aria-haspopup="listbox"
52+
aria-label="Search"
5153
aria-owns="rc_select_TEST_OR_SSR_list"
5254
autocomplete="off"
5355
class="rc-select-selection-search-input"

tests/__snapshots__/Multiple.test.tsx.snap

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ exports[`Select.Multiple render not display maxTagPlaceholder if maxTagCount not
2323
aria-controls="rc_select_TEST_OR_SSR_list"
2424
aria-expanded="false"
2525
aria-haspopup="listbox"
26+
aria-label="Search"
2627
aria-owns="rc_select_TEST_OR_SSR_list"
2728
autocomplete="off"
2829
class="rc-select-selection-search-input"
@@ -143,6 +144,7 @@ exports[`Select.Multiple render truncates tags by maxTagCount and show maxTagPla
143144
aria-controls="rc_select_TEST_OR_SSR_list"
144145
aria-expanded="false"
145146
aria-haspopup="listbox"
147+
aria-label="Search"
146148
aria-owns="rc_select_TEST_OR_SSR_list"
147149
autocomplete="off"
148150
class="rc-select-selection-search-input"
@@ -260,6 +262,7 @@ exports[`Select.Multiple render truncates tags by maxTagCount and show maxTagPla
260262
aria-controls="rc_select_TEST_OR_SSR_list"
261263
aria-expanded="false"
262264
aria-haspopup="listbox"
265+
aria-label="Search"
263266
aria-owns="rc_select_TEST_OR_SSR_list"
264267
autocomplete="off"
265268
class="rc-select-selection-search-input"
@@ -361,6 +364,7 @@ exports[`Select.Multiple render truncates values by maxTagTextLength 1`] = `
361364
aria-controls="rc_select_TEST_OR_SSR_list"
362365
aria-expanded="false"
363366
aria-haspopup="listbox"
367+
aria-label="Search"
364368
aria-owns="rc_select_TEST_OR_SSR_list"
365369
autocomplete="off"
366370
class="rc-select-selection-search-input"

tests/__snapshots__/Select.test.tsx.snap

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ exports[`Select.Basic no search 1`] = `
123123
aria-controls="undefined_list"
124124
aria-expanded="false"
125125
aria-haspopup="listbox"
126+
aria-label="Search"
126127
aria-owns="undefined_list"
127128
autocomplete="off"
128129
class="rc-select-selection-search-input"
@@ -208,6 +209,7 @@ exports[`Select.Basic render renders correctly 1`] = `
208209
aria-controls="undefined_list"
209210
aria-expanded="false"
210211
aria-haspopup="listbox"
212+
aria-label="Search"
211213
aria-owns="undefined_list"
212214
autocomplete="off"
213215
class="antd-selection-search-input"
@@ -255,6 +257,7 @@ exports[`Select.Basic render renders data-attributes correctly 1`] = `
255257
aria-controls="undefined_list"
256258
aria-expanded="false"
257259
aria-haspopup="listbox"
260+
aria-label="Search"
258261
aria-owns="undefined_list"
259262
autocomplete="off"
260263
class="antd-selection-search-input"
@@ -300,6 +303,7 @@ exports[`Select.Basic render renders disabled select correctly 1`] = `
300303
aria-controls="undefined_list"
301304
aria-expanded="false"
302305
aria-haspopup="listbox"
306+
aria-label="Search"
303307
aria-owns="undefined_list"
304308
autocomplete="off"
305309
class="antd-selection-search-input"
@@ -337,6 +341,7 @@ exports[`Select.Basic render renders role prop correctly 1`] = `
337341
aria-controls="undefined_list"
338342
aria-expanded="false"
339343
aria-haspopup="listbox"
344+
aria-label="Search"
340345
aria-owns="undefined_list"
341346
autocomplete="off"
342347
class="antd-selection-search-input"

tests/__snapshots__/Tags.test.tsx.snap

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ exports[`Select.Tags OptGroup renders correctly 1`] = `
7979
aria-controls="rc_select_TEST_OR_SSR_list"
8080
aria-expanded="true"
8181
aria-haspopup="listbox"
82+
aria-label="Search"
8283
aria-owns="rc_select_TEST_OR_SSR_list"
8384
autocomplete="off"
8485
class="rc-select-selection-search-input"
@@ -252,6 +253,7 @@ exports[`Select.Tags render not display maxTagPlaceholder if maxTagCount not rea
252253
aria-controls="rc_select_TEST_OR_SSR_list"
253254
aria-expanded="false"
254255
aria-haspopup="listbox"
256+
aria-label="Search"
255257
aria-owns="rc_select_TEST_OR_SSR_list"
256258
autocomplete="off"
257259
class="rc-select-selection-search-input"
@@ -369,6 +371,7 @@ exports[`Select.Tags render truncates tags by maxTagCount and show maxTagPlaceho
369371
aria-controls="rc_select_TEST_OR_SSR_list"
370372
aria-expanded="false"
371373
aria-haspopup="listbox"
374+
aria-label="Search"
372375
aria-owns="rc_select_TEST_OR_SSR_list"
373376
autocomplete="off"
374377
class="rc-select-selection-search-input"
@@ -483,6 +486,7 @@ exports[`Select.Tags render truncates tags by maxTagCount and show maxTagPlaceho
483486
aria-controls="rc_select_TEST_OR_SSR_list"
484487
aria-expanded="false"
485488
aria-haspopup="listbox"
489+
aria-label="Search"
486490
aria-owns="rc_select_TEST_OR_SSR_list"
487491
autocomplete="off"
488492
class="rc-select-selection-search-input"
@@ -581,6 +585,7 @@ exports[`Select.Tags render truncates values by maxTagTextLength 1`] = `
581585
aria-controls="rc_select_TEST_OR_SSR_list"
582586
aria-expanded="false"
583587
aria-haspopup="listbox"
588+
aria-label="Search"
584589
aria-owns="rc_select_TEST_OR_SSR_list"
585590
autocomplete="off"
586591
class="rc-select-selection-search-input"

tests/__snapshots__/ssr.test.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`Select.SSR should work 1`] = `"<div class="rc-select rc-select-single"><div class="rc-select-selector"><span class="rc-select-selection-search"><input type="search" autoComplete="off" class="rc-select-selection-search-input" role="combobox" aria-expanded="false" aria-haspopup="listbox" aria-owns="undefined_list" aria-autocomplete="list" aria-controls="undefined_list" value="" readonly="" unselectable="on" style="opacity:0"/></span><span class="rc-select-selection-placeholder"></span></div></div>"`;
3+
exports[`Select.SSR should work 1`] = `"<div class="rc-select rc-select-single"><div class="rc-select-selector"><span class="rc-select-selection-search"><input type="search" autoComplete="off" class="rc-select-selection-search-input" role="combobox" aria-label="Search" aria-expanded="false" aria-haspopup="listbox" aria-owns="undefined_list" aria-autocomplete="list" aria-controls="undefined_list" value="" readonly="" unselectable="on" style="opacity:0"/></span><span class="rc-select-selection-placeholder"></span></div></div>"`;

0 commit comments

Comments
 (0)