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

Commit 5f06bd1

Browse files
TrueEddiearschmitz
authored andcommitted
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)
1 parent 01dc1e3 commit 5f06bd1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

js/widgets/popup.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,9 @@ $.widget( "mobile.popup", {
300300
target = $( targetElement );
301301
if ( 0 === target.parents().filter( ui.container[ 0 ] ).length ) {
302302
$( this.document[ 0 ].activeElement ).one( "focus", function(/* theEvent */) {
303-
target.blur();
303+
if ( targetElement.nodeName.toLowerCase() !== "body" ) {
304+
target.blur();
305+
}
304306
});
305307
ui.focusElement.focus();
306308
theEvent.preventDefault();

0 commit comments

Comments
 (0)