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 ' : minor
3
+ ---
4
+
5
+ Avoid referencing an ID that is not in the DOM
Original file line number Diff line number Diff line change @@ -1558,13 +1558,15 @@ export default class Select<
1558
1558
'aria-autocomplete' : 'list' as const ,
1559
1559
'aria-expanded' : menuIsOpen ,
1560
1560
'aria-haspopup' : true ,
1561
- 'aria-controls' : this . getElementId ( 'listbox' ) ,
1562
- 'aria-owns' : this . getElementId ( 'listbox' ) ,
1563
1561
'aria-errormessage' : this . props [ 'aria-errormessage' ] ,
1564
1562
'aria-invalid' : this . props [ 'aria-invalid' ] ,
1565
1563
'aria-label' : this . props [ 'aria-label' ] ,
1566
1564
'aria-labelledby' : this . props [ 'aria-labelledby' ] ,
1567
1565
role : 'combobox' ,
1566
+ ...( menuIsOpen && {
1567
+ 'aria-controls' : this . getElementId ( 'listbox' ) ,
1568
+ 'aria-owns' : this . getElementId ( 'listbox' ) ,
1569
+ } ) ,
1568
1570
...( ! isSearchable && {
1569
1571
'aria-readonly' : true ,
1570
1572
} ) ,
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