activeBtnClass never be removed when Ajax link handling is disabled #2017

Closed
arcatdmz opened this Issue Jul 3, 2011 · 5 comments

Projects

None yet

4 participants

@arcatdmz
arcatdmz commented Jul 3, 2011

When $.mobile.ajaxEnabled === false, $.mobile.activeBtnClass won't be removed from the clicked link after page transition is completed. Related code seems to be jquery.mobile.navigation.js.

As far as I know, $.mobile.activeBtnClass is added to the link in the vclick event handler and is removed after the page transition in the removeActiveLinkClass that requires $activeClickedLink to be set properly.
The $activeClickedLink is set in the click event handler at L1093, which is unreachable when $.mobile.ajaxEnabled === false since it's after if statement at L1041.

To my thinking, fundamental solution is to move the line to set $activeClickedLink just before the if statement.

Current adhoc solution is writing code like:

$(document).bind("changepage", function(){
    $("."+$.mobile.activeBtnClass).removeClass($.mobile.activeBtnClass);
});
@idrake
idrake commented Jul 5, 2011

That worked like a charm.

@idrake
idrake commented Jul 5, 2011

Oh, I should mention I was having the same issue with ajaxEnabled == true.

Here's the details of the issue as I see it:

Page1 loads, user clicks on link to page2
on Page2 in the pageShow event, the user is conditionally directed to Page3. This is done by calling the anchors click function to simulate the user clicking the default option on the page. Doing this in the pageShow event messes up the active link tracking.

@gseguin gseguin was assigned Jul 7, 2011
@toddparker
Contributor

A related issue is that if Ajax is enabled, if you click a button or listview item, it gets the active state. If Ajax is slow, you can click other items and they all get the active state so it feel broken. We should clear all other active states and kill the older requests (ignore 'em).

@gseguin
Member
gseguin commented Sep 1, 2011

@toddparker did you mean killing the ajax requests or just the visual state?

@gseguin gseguin added a commit that referenced this issue Sep 1, 2011
@gseguin gseguin Fix for issue #2017. Clear active link on vclick so there can be only…
… one active link at a time.
001e588
@toddparker
Contributor

@gseguin - The visual feedback for sure, but if i click 3 list items, i think we should transition to the latest click and just ignore the earlier requests. That part may be hard but the visual bit is at least a good first step. Looks very broken on slow connections if we have multiple active states.

@toddparker toddparker closed this Sep 1, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment