Skip to content

Commit e898b6b

Browse files
committed
Check if modalElement exists in handleFocus.
A race condition happens if you open a new window before closing the modal, as opening a new window has the side effect of blurring the current window.
1 parent 0b2028e commit e898b6b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/helpers/focusManager.js

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ function handleBlur(event) {
1010
function handleFocus(event) {
1111
if (needToFocus) {
1212
needToFocus = false;
13+
if (!modalElement) {
14+
return;
15+
}
1316
// need to see how jQuery shims document.on('focusin') so we don't need the
1417
// setTimeout, firefox doesn't support focusin, if it did, we could focus
1518
// the the element outisde of a setTimeout. Side-effect of this

0 commit comments

Comments
 (0)