Permalink
Browse files

[popup] New option: "dismissable": default: true, whether a click on …

…the screen or pressing Esc will dismiss the popup - note: pressing the "Back" button on the browser will dismiss the popup no matter what
  • Loading branch information...
1 parent 3d85b49 commit 352fb0be7fa4573822bf8bcf36450a5fd2641539 @gabrielschulhof gabrielschulhof committed Oct 7, 2012
Showing with 4 additions and 1 deletion.
  1. +4 −1 js/widgets/popup.js
View
@@ -52,6 +52,7 @@ define( [ "jquery",
closeLinkEvents: "click.popup",
navigateEvents: "navigate.popup",
closeEvents: "navigate.popup pagebeforechange.popup",
+ dismissable: true,
// NOTE Windows Phone 7 has a scroll position caching issue that
// requires us to disable popup history management by default
@@ -64,7 +65,9 @@ define( [ "jquery",
_eatEventAndClose: function( e ) {
e.preventDefault();
e.stopImmediatePropagation();
- this.close();
+ if ( this.options.dismissable ) {
+ this.close();
+ }
return false;
},

4 comments on commit 352fb0b

@ftorre104

"Please note that the correct spelling is [data-]dismissible, not [data-]dismiss_a_ble. The implementation and the popup doc page (http://jquerymobile.com/test/docs/pages/popup/index.html) use the correct spelling, but the data-attributes reference uses the misspelling (http://jquerymobile.com/test/docs/api/data-attributes.html)." per mkelement @ #5299. Just to help before any problems may be created in the switch!

@toddparker
Contributor

I just checked here and don't see "dismissable"
http://jquerymobile.com/test/docs/api/data-attributes.html

@ftorre104

Yeah, true. Guess they updated it in the documentation.
The point was moreso for anyone using this code -- you might want to use "dismissible" vs "dismissable" if you custom edit your files. So that your code will be compatible with jqm1.2.1 or jqm1.3 (whatever will have this data-dismissible feature).

@jaspermdegroot
Member

I changed it yesterday just before 1.3 beta release.

Please sign in to comment.