checkradiobox widget still work even it's disabled #1106

Closed
keshin opened this Issue Feb 17, 2011 · 5 comments

Projects

None yet

4 participants

@keshin
keshin commented Feb 17, 2011

version:1.0a3

the widget will be disabled when I invoke the disable method in version 1.0a2.

code:
$("input[name='redball']").not(":checked").checkboxradio('disable');

but in 1.0a3, It's just add the disable css class and still could be clicked/touched.

I check the source code on https://github.com/jquery/jquery-mobile/blob/master/js/jquery.mobile.forms.checkboxradio.js#L58

It looks like the listener does not do the check first.

@toddparker
Contributor

Good catch We need to check to make sure we're handling disabling correctly on all form widgets.

@gseguin gseguin was assigned Jun 20, 2011
@johnbender johnbender was assigned Sep 26, 2011
@johnbender
Contributor

@keshin,

Can you describe the issue in a bit more detail?

When you say "It's just add the disable css class and still could be clicked/touched" do you mean that it will still register the click or that the .ui-btn-down and .ui-btn-up classes will be applied? What specifically are you expecting to have happen when the radio/checkbox is disabled?

@toddparker

If you have some insight here that I'm missing feel free to chime in, I've been playing for a bit without finding any issue.

@toddparker
Contributor

I just took our full set of form elements and added the disabled attribute:
http://jsbin.com/icateq/
http://jsbin.com/icateq/edit

Checks and radios actually seem to be some of the better ones - they look disabled (% opacity) though you can click them so we might want to prevent all mouse events.

Looks like text inputs/textareas need the ui-disabled class but they aren't interactive.

The slider handle and flip switch fully works so that needs the ui-disabled class and for us to kill interactivity.

Selects need the ui-disabled class but they aren't interactive.

I know this is a bit beyond the scope of this ticket (feel free to make separate ones if you want) but we should just go through and fix these all up for RC1. Should be pretty straightforward.

@keshin
keshin commented Sep 27, 2011

@johnbender
Looks like this issue had been resolved in the later version:)

I means the "disable" function just add a "disabled[true]" attribute to the related checkbox and add a disable css class to the widget, in the other side, it dosen't prevent the click operation when user click on the widget.
you could see it in
https://github.com/jquery/jquery-mobile/blob/1.0a3/js/jquery.mobile.forms.checkboxradio.js#L58
and
https://github.com/jquery/jquery-mobile/blob/1.0a3/js/jquery.mobile.forms.checkboxradio.js#L149

@johnbender
Contributor

@toddparker @keshin

Thank you both, I'll should be able to handle it from here. I've created a separate ticket for to go through each form element and make sure they behave properly when disabled: #2541.

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