Permalink
Browse files

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

  • Loading branch information...
Josh Dean authored and gseguin committed Jan 17, 2012
1 parent 7a78822 commit 87db1cf5de38108e631e4eb23c7c6dcd56856367
Showing with 4 additions and 1 deletion.
  1. +4 −1 js/jquery.mobile.dialog.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() {
self.close();
});

4 comments on commit 87db1cf

@sheebz

This comment has been minimized.

Show comment
Hide comment
@sheebz

sheebz 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?

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?

@toddparker

This comment has been minimized.

Show comment
Hide comment
@toddparker

toddparker Mar 1, 2012

Contributor

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.

Contributor

toddparker replied Mar 1, 2012

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

This comment has been minimized.

Show comment
Hide comment
@sheebz

sheebz 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.

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

This comment has been minimized.

Show comment
Hide comment
@sheebz

sheebz Mar 1, 2012

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

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.