File tree Expand file tree Collapse file tree 7 files changed +9
-12
lines changed
packages/react-select/src Expand file tree Collapse file tree 7 files changed +9
-12
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' react-select ' : patch
3
+ ---
4
+
5
+ Avoid referencing an ID that is not in the DOM
Original file line number Diff line number Diff line change @@ -1560,13 +1560,15 @@ export default class Select<
1560
1560
'aria-autocomplete' : 'list' as const ,
1561
1561
'aria-expanded' : menuIsOpen ,
1562
1562
'aria-haspopup' : true ,
1563
- 'aria-controls' : this . getElementId ( 'listbox' ) ,
1564
- 'aria-owns' : this . getElementId ( 'listbox' ) ,
1565
1563
'aria-errormessage' : this . props [ 'aria-errormessage' ] ,
1566
1564
'aria-invalid' : this . props [ 'aria-invalid' ] ,
1567
1565
'aria-label' : this . props [ 'aria-label' ] ,
1568
1566
'aria-labelledby' : this . props [ 'aria-labelledby' ] ,
1569
1567
role : 'combobox' ,
1568
+ ...( menuIsOpen && {
1569
+ 'aria-controls' : this . getElementId ( 'listbox' ) ,
1570
+ 'aria-owns' : this . getElementId ( 'listbox' ) ,
1571
+ } ) ,
1570
1572
...( ! isSearchable && {
1571
1573
'aria-readonly' : true ,
1572
1574
} ) ,
Original file line number Diff line number Diff line change @@ -193,11 +193,9 @@ exports[`defaults - snapshot 1`] = `
193
193
>
194
194
<input
195
195
aria-autocomplete = " list"
196
- aria-controls = " react-select-2-listbox"
197
196
aria-describedby = " react-select-2-placeholder"
198
197
aria-expanded = " false"
199
198
aria-haspopup = " true"
200
- aria-owns = " react-select-2-listbox"
201
199
autocapitalize = " none"
202
200
autocomplete = " off"
203
201
autocorrect = " off"
Original file line number Diff line number Diff line change @@ -193,11 +193,9 @@ exports[`defaults - snapshot 1`] = `
193
193
>
194
194
<input
195
195
aria-autocomplete = " list"
196
- aria-controls = " react-select-2-listbox"
197
196
aria-describedby = " react-select-2-placeholder"
198
197
aria-expanded = " false"
199
198
aria-haspopup = " true"
200
- aria-owns = " react-select-2-listbox"
201
199
autocapitalize = " none"
202
200
autocomplete = " off"
203
201
autocorrect = " off"
Original file line number Diff line number Diff line change @@ -193,11 +193,9 @@ exports[`defaults - snapshot 1`] = `
193
193
>
194
194
<input
195
195
aria-autocomplete = " list"
196
- aria-controls = " react-select-2-listbox"
197
196
aria-describedby = " react-select-2-placeholder"
198
197
aria-expanded = " false"
199
198
aria-haspopup = " true"
200
- aria-owns = " react-select-2-listbox"
201
199
autocapitalize = " none"
202
200
autocomplete = " off"
203
201
autocorrect = " off"
Original file line number Diff line number Diff line change @@ -193,11 +193,9 @@ exports[`snapshot - defaults 1`] = `
193
193
>
194
194
<input
195
195
aria-autocomplete = " list"
196
- aria-controls = " react-select-2-listbox"
197
196
aria-describedby = " react-select-2-placeholder"
198
197
aria-expanded = " false"
199
198
aria-haspopup = " true"
200
- aria-owns = " react-select-2-listbox"
201
199
autocapitalize = " none"
202
200
autocomplete = " off"
203
201
autocorrect = " off"
Original file line number Diff line number Diff line change @@ -193,11 +193,9 @@ exports[`defaults > snapshot 1`] = `
193
193
>
194
194
<input
195
195
aria-autocomplete = " list"
196
- aria-controls = " react-select-2-listbox"
197
196
aria-describedby = " react-select-2-placeholder"
198
197
aria-expanded = " false"
199
198
aria-haspopup = " true"
200
- aria-owns = " react-select-2-listbox"
201
199
autocapitalize = " none"
202
200
autocomplete = " off"
203
201
autocorrect = " off"
You can’t perform that action at this time.
0 commit comments