Permalink
Browse files

Popup: do not call blur if the target is the body

In IE 10 (and possibly older versions of IE) when there is a single tab open
and a popup is displayed and there is another window on the same monitor,
calling target.blur() can cause the browser to go to the background because the
body element is the targetElement.  Ensuring the element is not the body element
before calling blur() fixes this issue.

Fixes gh-7639
Closes gh-7298
  • Loading branch information...
TrueEddie authored and arschmitz committed Apr 4, 2014
1 parent f0362f4 commit b14dd31f64c914e46e4460d61bd0cbb3232cf103
Showing with 3 additions and 1 deletion.
  1. +3 −1 js/widgets/popup.js
View
@@ -299,7 +299,9 @@ $.widget( "mobile.popup", {
target = $( targetElement );
if ( 0 === target.parents().filter( ui.container[ 0 ] ).length ) {
$( this.document[ 0 ].activeElement ).one( "focus", function(/* theEvent */) {
target.blur();
if ( targetElement.nodeName.toLowerCase() !== "body" ) {
target.blur();
}
});
ui.focusElement.focus();
theEvent.preventDefault();

0 comments on commit b14dd31

Please sign in to comment.