Skip to content

Commit

Permalink
Check if modalElement exists in handleFocus.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
maisano committed Apr 30, 2015
1 parent 0b2028e commit e898b6b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/helpers/focusManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ function handleBlur(event) {
function handleFocus(event) {
if (needToFocus) {
needToFocus = false;
if (!modalElement) {
return;
}
// need to see how jQuery shims document.on('focusin') so we don't need the
// setTimeout, firefox doesn't support focusin, if it did, we could focus
// the the element outisde of a setTimeout. Side-effect of this
Expand Down

0 comments on commit e898b6b

Please sign in to comment.