Skip to content
This repository

Anchor button stays rendered selected after click #1405

Closed
garyns opened this Issue · 8 comments

6 participants

garyns Ghislain Seguin Shawn Bierman Matthieu Chase Heimer Christian MacAuley & Co Flori
garyns

With the current repository code anchors with data-role=button are staying 'selected' (blue) after they are clicked. Input buttons are fine.

<div data-role="page">
  <div data-role="content">
    <a data-role="button" href="#">Anchor Button - Stays Selected</a>
    <input type="button" value="Input Button - OK">
  </div>
</div>

Whether this is another difference in handling for anchors (like a visited state) and buttons I'll leave for debate. In any case anchors initiating a JS call in a multi-page model always render selected after their first press.

garyns

Interestingly, if the JS function returns false, the anchor reverts back to its unselected state on Safari/Chrome desktop. However on the iPad (iOS 4.3) it always remains in the selected/presses state.

garyns

Its only been happening since I did a git pull this morning. in jquery.mobile.navigation.js, the addition of this line causes it:

//add active state on vclick
    $( "a" ).live( "vclick", function(){
        $(this).closest( ".ui-btn" ).not( ".ui-disabled" ).addClass( $.mobile.activeBtnClass );
    });
Shawn Bierman

Experiencing the same issue in Safari/Win7 and on DroidX. The ui-btn-active class isn't being removed.

Shawn Bierman

Sorry, should have included that I am using JQM a4.1 and jQuery 1.5.2

Matthieu Chase Heimer

Also seeing issue with ui-btn-active not being removed on Alpha4.1. Links with just data-role="button" have no problem but if you add data-rel="back" then that button will stay active. Notice the issue also happens with the generated back button in the header.

Demo here http://jsbin.com/apelu5/

Shawn Bierman

A quick workaround until it is resolved.

$("div").live("pagebeforehide", function(e) {
$(".dashboardListItemClickable").removeClass("ui-btn-active");
});

Christian MacAuley & Co
fabapps commented

Based on your workaround, I did this:

// workaround for active button state
var resetbutton = function(buttonname) {
$(buttonname).removeClass("ui-btn-active");
}

Then added the function call into any click events that would have put the button into its pressed state:
$("#homelink").click( function(e) { resetbutton(this); e.preventDefault(); } );

Flori

please fix this, it looks annoying ;-)

Ghislain Seguin gseguin referenced this issue from a commit
Ghislain Seguin Fix for issue #1405: Moved assignment of $activeClickedLink to the vc…
…lick handler in charge of adding the active state
9f3836e
Jim Tilson brendansoftllc referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
Ghislain Seguin gseguin closed this
Timmy Willison timmywil referenced this issue from a commit
Ghislain Seguin Fix for issue #1405: Moved assignment of $activeClickedLink to the vc…
…lick handler in charge of adding the active state
38d2520
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.