Skip to content

Commit 1d7449f

Browse files
authored
fix(modal, flyout): ignore observed non inputs for autofocus
The observer should only retrigger autofocus if an input has changed, not for any kind of tabbable element.
1 parent 4006122 commit 1d7449f

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/definitions/modules/flyout.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,9 @@
525525
$removedInputs = $(collectNodes(mutation.removedNodes)).filter('a[href], [tabindex], :input');
526526
if ($addedInputs.length > 0 || $removedInputs.length > 0) {
527527
shouldRefreshInputs = true;
528-
ignoreAutofocus = false;
528+
if ($addedInputs.filter(':input').length > 0 || $removedInputs.filter(':input').length > 0) {
529+
ignoreAutofocus = false;
530+
}
529531
}
530532
}
531533

src/definitions/modules/modal.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,9 @@
290290
$removedInputs = $(collectNodes(mutation.removedNodes)).filter('a[href], [tabindex], :input');
291291
if ($addedInputs.length > 0 || $removedInputs.length > 0) {
292292
shouldRefreshInputs = true;
293-
ignoreAutofocus = false;
293+
if ($addedInputs.filter(':input').length > 0 || $removedInputs.filter(':input').length > 0) {
294+
ignoreAutofocus = false;
295+
}
294296
}
295297
}
296298

0 commit comments

Comments
 (0)