Skip to content

Commit

Permalink
Popup: replaced activeElement with targetElement for correct focus
Browse files Browse the repository at this point in the history
  • Loading branch information
ldeluca committed Oct 15, 2014
1 parent cc548fd commit 3e5ad2d
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions js/widgets/popup.js
Expand Up @@ -297,9 +297,9 @@ $.widget( "mobile.popup", {

if ( targetElement !== ui.container[ 0 ] ) {
target = $( targetElement );
if ( 0 === target.parents().filter( ui.container[ 0 ] ).length ) {
if ( !$.contains( target.parents(), ui.container[ 0 ] ) ) {
$( this.document[ 0 ].activeElement ).one( "focus", $.proxy( function(/* theEvent */) {
this._safelyBlur( this.document[ 0 ].activeElement );
this._safelyBlur( targetElement );
}, this ) );
ui.focusElement.focus();
theEvent.preventDefault();
Expand Down Expand Up @@ -631,9 +631,9 @@ $.widget( "mobile.popup", {
}
},

_safelyBlur: function( currElement ){
if (currElement !== this.window[ 0 ] && currElement.nodeName.toLowerCase() !== "body") {
currElement.blur();
_safelyBlur: function( currentElement ){
if (currentElement !== this.window[ 0 ] && currentElement.nodeName.toLowerCase() !== "body") {
currentElement.blur();
}
},

Expand Down Expand Up @@ -732,8 +732,6 @@ $.widget( "mobile.popup", {
var container = this._ui.container,
id = this.element.attr( "id" );

container.removeAttr( "tabindex" );

// remove the global mutex for popups
$.mobile.popup.active = undefined;

Expand Down

0 comments on commit 3e5ad2d

Please sign in to comment.