Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

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 gh-7639
Closes gh-7298

(cherry picked from commit b14dd31)
  • Loading branch information
TrueEddie authored and arschmitz committed Aug 26, 2014
1 parent 01dc1e3 commit 5f06bd1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion js/widgets/popup.js
Expand Up @@ -300,7 +300,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 5f06bd1

Please sign in to comment.