Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[popup] To implement click-on-screen-to-dismiss-popup one must bind t…

…he "vclick" handler to the document rather than the screen, in order to prevent unpleasantness on Android 4.0. WP7 nevertheless requires the code to remain as is, because handling the screen vclick after it has bubbled to the document causes text and inputs underneath the screen to handle and then swallow the event.
  • Loading branch information...
commit 5572b5e10e992a95302d618694fe8bf8b4a67300 1 parent 5463fc8
@gabrielschulhof gabrielschulhof authored
Showing with 13 additions and 2 deletions.
  1. +13 −2 js/widgets/popup.js
View
15 js/widgets/popup.js
@@ -53,11 +53,12 @@ define( [ "jquery",
e.preventDefault();
e.stopImmediatePropagation();
this.close();
+ return false;
},
_handleWindowKeyUp: function( e ) {
if ( this._isOpen && e.keyCode === $.mobile.keyCode.ESCAPE ) {
- this._eatEventAndClose( e );
+ return this._eatEventAndClose( e );
}
},
@@ -116,6 +117,12 @@ define( [ "jquery",
}
},
+ _closeOnScreenVClick: function( e ) {
+ if ( e.target === this._ui.screen[ 0 ] ) {
+ return this._eatEventAndClose( e );
+ }
+ },
+
_create: function() {
var ui = {
screen: $( "<div class='ui-screen-hidden ui-popup-screen fade'></div>" ),
@@ -175,7 +182,11 @@ define( [ "jquery",
self._setOption( key, value, true );
});
- ui.screen.bind( "vclick", $.proxy( this, "_eatEventAndClose" ) );
+ if ( $.mobile.browser.ie ) {
+ ui.screen.bind( "vclick", $.proxy( this, "_eatEventAndClose" ) );
+ } else {
+ this._on( $( document ), { "vclick": "_closeOnScreenVClick" } );
+ }
$.each( this._globalHandlers, function( idx, value ) {
value.src.bind( value.handler );
Please sign in to comment.
Something went wrong with that request. Please try again.