Skip to content

Commit

Permalink
Popup: do not call blur if the target is the body
Browse files Browse the repository at this point in the history
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 jquery-archivegh-7639
Closes jquery-archivegh-7298
  • Loading branch information
TrueEddie authored and agcolom committed Nov 26, 2014
1 parent 09f29d4 commit 526d521
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion js/widgets/popup.js
Expand Up @@ -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();
Expand Down

0 comments on commit 526d521

Please sign in to comment.