Skip to content

Commit b18e466

Browse files
authored
fix: aria-activedescendant ARIA attributes must conform to valid values (#966)
1 parent 3118cbc commit b18e466

File tree

7 files changed

+3
-18
lines changed

7 files changed

+3
-18
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
"jsonp": "^0.2.1",
7171
"np": "^7.5.0",
7272
"prettier": "^2.7.1",
73+
"querystring": "^0.2.1",
7374
"rc-dialog": "^9.0.0",
7475
"rc-test": "^7.0.9",
7576
"typescript": "^4.2.3"

src/Selector/Input.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ const Input: React.RefForwardingComponent<InputRef, InputProps> = (
9595
'aria-owns': `${id}_list`,
9696
'aria-autocomplete': 'list',
9797
'aria-controls': `${id}_list`,
98-
'aria-activedescendant': activeDescendantId,
98+
'aria-activedescendant': open ? activeDescendantId : undefined,
9999
...attrs,
100100
value: editable ? value : '',
101101
maxLength,

tests/__snapshots__/Combobox.test.tsx.snap

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ exports[`Select.Combobox renders controlled correctly 1`] = `
1111
class="rc-select-selection-search"
1212
>
1313
<input
14-
aria-activedescendant="rc_select_TEST_OR_SSR_list_0"
1514
aria-autocomplete="list"
1615
aria-controls="rc_select_TEST_OR_SSR_list"
1716
aria-expanded="false"
@@ -45,7 +44,6 @@ exports[`Select.Combobox renders correctly 1`] = `
4544
class="rc-select-selection-search"
4645
>
4746
<input
48-
aria-activedescendant="rc_select_TEST_OR_SSR_list_0"
4947
aria-autocomplete="list"
5048
aria-controls="rc_select_TEST_OR_SSR_list"
5149
aria-expanded="false"

tests/__snapshots__/Multiple.test.tsx.snap

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ exports[`Select.Multiple render not display maxTagPlaceholder if maxTagCount not
1919
style="width: 0px;"
2020
>
2121
<input
22-
aria-activedescendant="rc_select_TEST_OR_SSR_list_0"
2322
aria-autocomplete="list"
2423
aria-controls="rc_select_TEST_OR_SSR_list"
2524
aria-expanded="false"
@@ -140,7 +139,6 @@ exports[`Select.Multiple render truncates tags by maxTagCount and show maxTagPla
140139
style="width: 0px;"
141140
>
142141
<input
143-
aria-activedescendant="rc_select_TEST_OR_SSR_list_0"
144142
aria-autocomplete="list"
145143
aria-controls="rc_select_TEST_OR_SSR_list"
146144
aria-expanded="false"
@@ -258,7 +256,6 @@ exports[`Select.Multiple render truncates tags by maxTagCount and show maxTagPla
258256
style="width: 0px;"
259257
>
260258
<input
261-
aria-activedescendant="rc_select_TEST_OR_SSR_list_0"
262259
aria-autocomplete="list"
263260
aria-controls="rc_select_TEST_OR_SSR_list"
264261
aria-expanded="false"
@@ -360,7 +357,6 @@ exports[`Select.Multiple render truncates values by maxTagTextLength 1`] = `
360357
style="width: 0px;"
361358
>
362359
<input
363-
aria-activedescendant="rc_select_TEST_OR_SSR_list_0"
364360
aria-autocomplete="list"
365361
aria-controls="rc_select_TEST_OR_SSR_list"
366362
aria-expanded="false"

tests/__snapshots__/Select.test.tsx.snap

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ exports[`Select.Basic no search 1`] = `
119119
class="rc-select-selection-search"
120120
>
121121
<input
122-
aria-activedescendant="undefined_list_0"
123122
aria-autocomplete="list"
124123
aria-controls="undefined_list"
125124
aria-expanded="false"
@@ -158,7 +157,6 @@ exports[`Select.Basic render renders aria-attributes correctly 1`] = `
158157
class="antd-selection-search"
159158
>
160159
<input
161-
aria-activedescendant="undefined_list_0"
162160
aria-autocomplete="list"
163161
aria-controls="undefined_list"
164162
aria-expanded="false"
@@ -206,7 +204,6 @@ exports[`Select.Basic render renders correctly 1`] = `
206204
class="antd-selection-search"
207205
>
208206
<input
209-
aria-activedescendant="undefined_list_0"
210207
aria-autocomplete="list"
211208
aria-controls="undefined_list"
212209
aria-expanded="false"
@@ -254,7 +251,6 @@ exports[`Select.Basic render renders data-attributes correctly 1`] = `
254251
class="antd-selection-search"
255252
>
256253
<input
257-
aria-activedescendant="undefined_list_0"
258254
aria-autocomplete="list"
259255
aria-controls="undefined_list"
260256
aria-expanded="false"
@@ -300,7 +296,6 @@ exports[`Select.Basic render renders disabled select correctly 1`] = `
300296
class="antd-selection-search"
301297
>
302298
<input
303-
aria-activedescendant="undefined_list_0"
304299
aria-autocomplete="list"
305300
aria-controls="undefined_list"
306301
aria-expanded="false"
@@ -338,7 +333,6 @@ exports[`Select.Basic render renders role prop correctly 1`] = `
338333
class="antd-selection-search"
339334
>
340335
<input
341-
aria-activedescendant="undefined_list_0"
342336
aria-autocomplete="list"
343337
aria-controls="undefined_list"
344338
aria-expanded="false"

tests/__snapshots__/Tags.test.tsx.snap

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,6 @@ exports[`Select.Tags render not display maxTagPlaceholder if maxTagCount not rea
248248
style="width: 0px;"
249249
>
250250
<input
251-
aria-activedescendant="rc_select_TEST_OR_SSR_list_0"
252251
aria-autocomplete="list"
253252
aria-controls="rc_select_TEST_OR_SSR_list"
254253
aria-expanded="false"
@@ -366,7 +365,6 @@ exports[`Select.Tags render truncates tags by maxTagCount and show maxTagPlaceho
366365
style="width: 0px;"
367366
>
368367
<input
369-
aria-activedescendant="rc_select_TEST_OR_SSR_list_0"
370368
aria-autocomplete="list"
371369
aria-controls="rc_select_TEST_OR_SSR_list"
372370
aria-expanded="false"
@@ -481,7 +479,6 @@ exports[`Select.Tags render truncates tags by maxTagCount and show maxTagPlaceho
481479
style="width: 0px;"
482480
>
483481
<input
484-
aria-activedescendant="rc_select_TEST_OR_SSR_list_0"
485482
aria-autocomplete="list"
486483
aria-controls="rc_select_TEST_OR_SSR_list"
487484
aria-expanded="false"
@@ -580,7 +577,6 @@ exports[`Select.Tags render truncates values by maxTagTextLength 1`] = `
580577
style="width: 0px;"
581578
>
582579
<input
583-
aria-activedescendant="rc_select_TEST_OR_SSR_list_0"
584580
aria-autocomplete="list"
585581
aria-controls="rc_select_TEST_OR_SSR_list"
586582
aria-expanded="false"

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" aria-activedescendant="undefined_list_0" 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-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)