back buttons are now going back "too far" #1870

Closed
shawnwall opened this Issue Jun 21, 2011 · 8 comments

Projects

None yet

5 participants

@shawnwall

I'm testing out beta1 and read about the back button change. I've modified my simple site which consists of three pages:

-index
-subpage
-subsubpage

I've added data-add-back-btn="true" to the div's with data-role of page and the buttons are now appearing again. The defect is that when I click from index to subpage, then subpage to subsubpage, the back link in the upper left takes me all the way back to the index page instead of the subpage.

The links between the pages are normal A links going to separate actual pages through the default ajax (they are not separate divs within one single page).

@shawnwall

The same defect occurs when using:

$(document).bind("mobileinit", function() {
      $.mobile.page.prototype.options.addBackBtn = true;
 });
@mweimerskirch

Same problem here. I might add that I have the pages as separate divs in one single document. I also noticed that the "native" back button still works.

@Phliplip

I have the same problem, and would like to add that closing dialogs also triggers the bug.

@mweimerskirch

Digging deeper, I found that history.back() is executed twice because of this line:

$( document ).bind( $.mobile.useFastClick ? "vclick click" : "click", function( event ) {

Disabling fastClick should be a valid workaround, but that does not work either, see #1869.
So for now I set "useFastClick" to false in the jquery mobile source code so that only the "click" event is used and not both "vclick" and "click".

BTW: The problem appeared on both Chrome 13beta and Firefox 5. I did not yet bother testing on a mobile device.

@IgitBuh
IgitBuh commented Jun 21, 2011

Same here. Strangly it's not consistently happening. In rare cases it's correctly going back one step only.
edit: tested on iOS 4.3.2

@shawnwall

I just noticed that it is consistently working for me when I test the site on mobile safari. The original issue still stands with desktop safari.

@scottjehl
Contributor

So, the vclick + click is in there as a workaround for an inconsistent bug Android 2.1, but now that we've pushed beta out, I'm going to remove that double binding and work on a better solution for the Android issue. Fix coming shortly.

@scottjehl scottjehl pushed a commit that closed this issue Jun 21, 2011
scottjehl removed vclick + click combined event binding, which was in there as …
…a workaround for a not-consistently-occurring bug in Android 2.1. I think the real issue is related to lack of dynamic base tag support, and that occasionally, a relative href click will use default handling in 2.1 and go where it shouldn't (ignoring the base href). Either way, this double binding causes history problems in Safari, so I'm removing it while we search for a better 2.1 workaround. Fixes #1870
c227535
@scottjehl scottjehl closed this in c227535 Jun 21, 2011
@Phliplip

Still have issues with iOS.. Also an intentional doubletab/click will mosdef take you 2 pages back, and a tripple tab/click wil wil take you back 3 pages. I tried this with http://www.jquerymobile.com/test/ -> Pages and dialogs -> Dialogs -> Open first dialog.. Tapping close muliple times. 3 times takes me back to front page of ../test/

Also the initial problem still occour - where you click (or intend to click) only once - and it takes you back 2 pages. Though not as common as before, tried with newest JQM-source (g7451a4b) on my dev site.

Lastly, using Firefox 3.6.17 - will go 2 pages back everytime.

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