1.3.2 -> 1.4.3: Disabling checkboxes not working anymore #7598

Closed
lukaseckert opened this Issue Jul 30, 2014 · 2 comments

Projects

None yet

3 participants

@lukaseckert

After migration from 1.3.2 to 1.4.3, the code to disable checkboxes does not work anymore:

$('#box1').prop('disabled', true).checkboxradio('refresh');

The checkbox cannot be clicked anymore, but the style is not adjusted (still looks like an enabled checkbox). When the checkbox is already disabled in the static HTML code from the server, the disabled styles are applied.

I've prepared two JSFiddles with the same code:
http://jsfiddle.net/gXgQ7/1/ (jQuery 1.9.1, jQM 1.3.2, working)
http://jsfiddle.net/S6fpr (jQuery 2.1.0, jQM 1.4.3 not working)

Tested on Chrome 36.0.1985.125, Windows 7

@gabrielschulhof gabrielschulhof added this to the 1.4.4 milestone Jul 30, 2014
@gabrielschulhof gabrielschulhof self-assigned this Jul 30, 2014
@gabrielschulhof
Contributor

@lukaseckert Dang! This is a regression! Fortunately, there's an alternative way of disabling a checkbox:

$( "#my-checkbox" ).checkboxradio( "option", "disabled", newValue );

This will take care of both the prop and the appearance.

@gabrielschulhof gabrielschulhof added a commit that referenced this issue Jul 31, 2014
@gabrielschulhof gabrielschulhof Checkboxradio: refresh() has to check whether to disable or not
(cherry picked from commit b33ec10)

Closes gh-7600
Fixes gh-7598
2f45cb9
@agcolom agcolom added a commit to agcolom/jquery-mobile that referenced this issue Nov 26, 2014
@gabrielschulhof @agcolom gabrielschulhof + agcolom Checkboxradio: refresh() has to check whether to disable or not
Closes gh-7600
Fixes gh-7598
cf185f8
@paulie4
paulie4 commented Jun 26, 2015

This is not correctly fixed, since for some reason, other parts of the checkboxradio code look at a separate options.disabled instead of just looking at the element's disabled property. The fix correctly sets or unsets the "ui-state-disabled" class, but the separate options.disabled property is not being updated. Here's an example showing a non-disabled checkboxradio that acts as if it's not being clicked because of the incorrect state of options.disabled:
http://jsfiddle.net/1jvLr3hv/3/

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