Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#9602 closed bug (fixed)

Button: ui-state-active remains on disabled button

Reported by: darek Owned by:
Priority: minor Milestone: 1.11.0
Component: ui.button Version: 1.10.3
Keywords: Cc:
Blocked by: Blocking:

Description

If a button gets disabled during click it doesn't go into "disabled" state correctly and it has both "active" and "disabled" styles. Here's the demonstrated situation:

http://jsfiddle.net/Qsym6/4/

It is reproducible on the latest Chrome and Firefox. On IE9 it works a little bit better but it is also buggy.

Change History (7)

comment:1 Changed 9 years ago by tj.vantoll

Resolution: notabug
Status: newclosed

Your test case is using a very old version of jQuery UI. This appears to be working fine in the latest version - http://jsfiddle.net/tj_vantoll/PeDqr/. If you can recreate the issue with 1.10.3 let us know.

comment:2 Changed 9 years ago by darek

My problem is also visible on jQueryUI 1.10.3 but not with the latest official css theme. The main problem is that button element gets two classes in my scenario: "ui-button-disabled" (which is right) and "ui-state-active" (which I believe is not right for disabled button). Here's the generated markup from your jsFiddle:

<button type="button" id="btn" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only ui-state-active ui-button-disabled ui-state-disabled" role="button" aria-disabled="true" disabled=""><span class="ui-button-text">Button</span></button>

I have my own CSS and I can mask the problem there, but shouldn't "ui-state-active" class be always removed for disabled button?

comment:3 Changed 9 years ago by tj.vantoll

Resolution: notabug
Status: closedreopened
Summary: Button doesn't remove active state when disabled and clickedButton: ui-state-active remains on disabled button

Ok, I see this now. The internal mousedown handler (that adds ui-state-active is running before the custom blur event. You can workaround this for now with a setTimeout - http://jsfiddle.net/tj_vantoll/eyBmD/.

I suppose we should just blanket remove ui-state-active when disabling a button. I can't think of a reason to ever leave it.

comment:4 Changed 9 years ago by tj.vantoll

Status: reopenedopen

comment:5 Changed 9 years ago by robotdan

I suppose we should just blanket remove ui-state-active when disabling a button. I can't think of a reason to ever leave it.


I've submitted a pull request and updated the testcase to use the fix branch.

https://github.com/jquery/jquery-ui/pull/1151
http://jsfiddle.net/VeX37/1/

Last edited 9 years ago by robotdan (previous) (diff)

comment:6 Changed 9 years ago by Daniel DeGroff

Resolution: fixed
Status: openclosed

Button: Remove ui-state-active when disabling buttons

Fixes #9602 Closes gh-1151

Changeset: 23d7d50f374f71efec418276a343e947cb80aea6

comment:7 Changed 9 years ago by Scott González

Milestone: none1.11.0
Note: See TracTickets for help on using tickets.