File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
core/src/utils/input-shims/hacks Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -195,7 +195,13 @@ const setManualFocus = (el: HTMLElement) => {
195
195
* listener from incorrectly moving focus back to the input. That approach
196
196
* would be less maintainable and more error-prone.
197
197
*/
198
- if ( document . activeElement ?. parentNode === el . parentNode ) {
198
+ const inputId = el . getAttribute ( 'id' ) ;
199
+ const label = el . closest ( `label[for="${ inputId } "]` ) ;
200
+ const activeElLabel = document . activeElement ?. closest ( `label[for="${ inputId } "]` ) ;
201
+
202
+ if ( label !== null && label === activeElLabel ) {
203
+ // If the label is the same as the active element label, then
204
+ // we don't need to set the `SKIP_SCROLL_ASSIST` and reset focus.
199
205
return ;
200
206
}
201
207
You can’t perform that action at this time.
0 commit comments