Skip to content
Browse files

Fix to #3351, dialogs reopening when attempting to close them

  • Loading branch information...
1 parent 7a78822 commit 87db1cf5de38108e631e4eb23c7c6dcd56856367 Josh Dean committed with gseguin Jan 16, 2012
Showing with 4 additions and 1 deletion.
  1. +4 −1 js/
5 js/
@@ -33,7 +33,10 @@ $.widget( "mobile.dialog", $.mobile.widget, {
// this must be an anonymous function so that select menu dialogs can replace
// the close method. This is a change from previously just defining data-rel=back
// on the button and letting nav handle it
- headerCloseButton.bind( "vclick", function() {
+ //
+ // Use click rather than vclick in order to prevent the possibility of unintentionally
+ // reopening the dialog if the dialog opening item was directly under the close button.
+ headerCloseButton.bind( "click", function() {

4 comments on commit 87db1cf

sheebz commented on 87db1cf Feb 29, 2012

Why was this switched? This is causing big problems for us because widgets such as jquery mobile datebox on safari/ios - the controls use vclick and not click to close the dialog. Also, if you read the mobile docs, Jquery mobile has"useFastClick" (vclick) as the default option - doesn't it make more sense for the event to listen for vclick?


Because of browser quirks, using vclick for navigation like this can result in what seem like double events. Click is safer in this case, even if it's a bit slower.

sheebz commented on 87db1cf Mar 1, 2012

My problem isn't that its slower, my issue with this change is breaks any code which tries to close a dialog by firing a vclick event - the dialog will just hang at the top of the screen and never close - datebox specifically has this issue. It also contradicts the fastclick documentation and creates a very difficult to find bug that only shows on iOS/Safari.

sheebz commented on 87db1cf Mar 1, 2012

Maybe we can find a way to bind to both events so that jqm can maintain compatibility with existing code?

Please sign in to comment.
Something went wrong with that request. Please try again.