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

(cherry picked from commit b14dd31)
  • Loading branch information...
1 parent 01dc1e3 commit 5f06bd1aa39d7746e9cbf798fa91120a484505b1 @TrueEddie TrueEddie committed with arschmitz Apr 4, 2014
Showing with 3 additions and 1 deletion.
  1. +3 −1 js/widgets/popup.js
View
@@ -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();

0 comments on commit 5f06bd1

Please sign in to comment.