Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Anchor button stays rendered selected after click #1405

Closed
garyns opened this Issue · 8 comments

6 participants

@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 );
    });
@shawnbierman

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

@shawnbierman

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

@chasetec

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/

@shawnbierman

A quick workaround until it is resolved.

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

@fabapps

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(); } );

@florianbachmann

please fix this, it looks annoying ;-)

@gseguin gseguin referenced this issue from a commit
@gseguin gseguin Fix for issue #1405: Moved assignment of $activeClickedLink to the vc…
…lick handler in charge of adding the active state
9f3836e
@brendansoftllc brendansoftllc referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@gseguin gseguin closed this
@timmywil timmywil referenced this issue from a commit
@gseguin gseguin 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.