Closing a dialog or using data-rel=back on dialog does back twice #5608

Closed
rthijssen opened this Issue Feb 7, 2013 · 3 comments

Projects

None yet

3 participants

@rthijssen

I noticed while closing a dialog the close/hide function causes the browser to go back 2 pages in stead of 1. An example of this occurs in the following code:

http://jsbin.com/onibuc/191/edit

To reproduce:
Change to page 2 -> open the dialog -> hide the dialog -> You'll end up on page 1.

This occurs both with the $("#dialog").dialog("hide") and data-rel=back methods.

[edit]
This issues does not show in 1.1.1 but does in the latest release of 1.3 (1.3.0 rc1)
Also the transition effect set just for the dialog is after this adopted by the "regular" pages.
Example: the dialog is shown using the 'pop' transition. After pressing the back button all other pages will from now on use the 'pop' transition, in stead of the default set value (fade in my case)
[/edit]

@mrextreme

I think it is the very same bug which makes my life miserable with Chromium on Linux and other WebKit-based browsers on Android, and JQM 1.3.0, but when I use popup.close(). See my issue #5733.

@mrextreme

I wonder if #5733 also applies here?

@gabrielschulhof

The reason it seems to be going back twice is that you're explicitly turning off changeHash when you're opening the dialog. This means that no browser history entry is created for the dialog. The dialog's close method does not know whether the dialog was opened with changeHash: true or changeHash: false. It simply checks whether hash handling is turned on ($.mobile.hashListeningEnabled). So, to avoid the behaviour you're seeing, before you call close() on the dialog you must turn temporarily off hash listening, like this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment