Radiobuttons can't be selected once they are selected, then de-selected #1532

Closed
toddparker opened this Issue Apr 28, 2011 · 14 comments

Comments

Projects
None yet
7 participants
@toddparker
Contributor

toddparker commented Apr 28, 2011

This is a recent and pretty major regression on all platforms:

  1. Go here: http://jquerymobile.com/test/docs/forms/forms-radiobuttons.html
  2. Click on the first radiobutton, then the second
  3. If you then click back on the first radiobutton, it won't be selected (visually anyway)

Maybe this is related to the active class tweak we recently landed.

@kriand

This comment has been minimized.

Show comment
Hide comment
@kriand

kriand Apr 29, 2011

I have noticed similar behavior with custom multiple selectmenus, at least on mobile Safari.

Could it be related?

  1. Go here http://jquerymobile.com/demos/1.0a4.1/#docs/forms/forms-selects.html and click the multiple select.
  2. Select the first option
  3. Select the second option
  4. Try to deselect the first option again (fails)

kriand commented Apr 29, 2011

I have noticed similar behavior with custom multiple selectmenus, at least on mobile Safari.

Could it be related?

  1. Go here http://jquerymobile.com/demos/1.0a4.1/#docs/forms/forms-selects.html and click the multiple select.
  2. Select the first option
  3. Select the second option
  4. Try to deselect the first option again (fails)

@johnbender johnbender closed this in 377c006 May 2, 2011

@mobilizer

This comment has been minimized.

Show comment
Hide comment
@mobilizer

mobilizer May 2, 2011

This error is related to JQuery 1.6 RC1.

Selection is now fixed but the "change" event doesn't get triggered on reselecting the previously selected element.

$("input[name='selction-name']")
.live( "change",...

This error is related to JQuery 1.6 RC1.

Selection is now fixed but the "change" event doesn't get triggered on reselecting the previously selected element.

$("input[name='selction-name']")
.live( "change",...

@toddparker

This comment has been minimized.

Show comment
Hide comment
@toddparker

toddparker May 2, 2011

Contributor

@mobilizer - does John Bender's fix resolve the issue for you? Just wondering if your comment is here to help us understand why the issue cropped up or that it didn't work for you. This is why we're trying to get RC builds on jQuery core in early to catch breaking changes like this.

Contributor

toddparker commented May 2, 2011

@mobilizer - does John Bender's fix resolve the issue for you? Just wondering if your comment is here to help us understand why the issue cropped up or that it didn't work for you. This is why we're trying to get RC builds on jQuery core in early to catch breaking changes like this.

@mobilizer

This comment has been minimized.

Show comment
Hide comment
@mobilizer

mobilizer May 2, 2011

"Just wondering if your comment is here to help us understand why the issue cropped up or that it didn't work for you. "

Both ;)

1.) By reverting to jQuery 1.5.x the issue disappears completely

2.) John's fix partly fixes the issue. Everything is looking good with it. You can reselect the radio buttons again. But the "change" event is not triggered on selecting a previously selected element.

"Just wondering if your comment is here to help us understand why the issue cropped up or that it didn't work for you. "

Both ;)

1.) By reverting to jQuery 1.5.x the issue disappears completely

2.) John's fix partly fixes the issue. Everything is looking good with it. You can reselect the radio buttons again. But the "change" event is not triggered on selecting a previously selected element.

@ghost ghost assigned johnbender May 2, 2011

@toddparker

This comment has been minimized.

Show comment
Hide comment
@toddparker

toddparker May 2, 2011

Contributor

Gotcha. Ok, I assigned John to look at this again. Thanks for your help.

Contributor

toddparker commented May 2, 2011

Gotcha. Ok, I assigned John to look at this again. Thanks for your help.

@toddparker toddparker reopened this May 2, 2011

@johnbender

This comment has been minimized.

Show comment
Hide comment
@johnbender

johnbender May 2, 2011

Contributor

Mobilizer,

Thanks for sticking with this issue and keeping us informed, I'll put in a fix tonight with tests.

Contributor

johnbender commented May 2, 2011

Mobilizer,

Thanks for sticking with this issue and keeping us informed, I'll put in a fix tonight with tests.

@johnbender

This comment has been minimized.

Show comment
Hide comment
@johnbender

johnbender May 3, 2011

Contributor

mobilizer,

I suppose this is what I get for claiming I would have a fix tonight, but the expando property checked is misbehaving in chrome for me, but seems to be working in firefox. Hopefully I'll have more information tomorrow.

Contributor

johnbender commented May 3, 2011

mobilizer,

I suppose this is what I get for claiming I would have a fix tonight, but the expando property checked is misbehaving in chrome for me, but seems to be working in firefox. Hopefully I'll have more information tomorrow.

@johnbender

This comment has been minimized.

Show comment
Hide comment
@johnbender

johnbender May 3, 2011

Contributor

http://i.imgur.com/ri4vN.png

For those who are interested or possibly better informed than I am as to why chrome might be behaving this way

Contributor

johnbender commented May 3, 2011

http://i.imgur.com/ri4vN.png

For those who are interested or possibly better informed than I am as to why chrome might be behaving this way

@mobilizer

This comment has been minimized.

Show comment
Hide comment
@mobilizer

mobilizer May 3, 2011

There is something changed in JQuery 1.6 RC1... issue #8500 (RADIOS AND CHECKBOXES REVERT TO DEFAULT (HTML) STATE WHEN WRAPPED IN IE) http://bugs.jquery.com/ticket/8500

There is something changed in JQuery 1.6 RC1... issue #8500 (RADIOS AND CHECKBOXES REVERT TO DEFAULT (HTML) STATE WHEN WRAPPED IN IE) http://bugs.jquery.com/ticket/8500

@wengzhiwen

This comment has been minimized.

Show comment
Hide comment
@wengzhiwen

wengzhiwen May 7, 2011

Meet the same issue with jQuery 1.6.
Moved back to jQuery 1.5.2

Meet the same issue with jQuery 1.6.
Moved back to jQuery 1.5.2

@alertmybanjos

This comment has been minimized.

Show comment
Hide comment
@alertmybanjos

alertmybanjos May 26, 2011

I was able to solve this with jQuery 1.6 by changing .attr to .prop in the checkboxradio plugin where the vclick function is bound to the label.

This issue is directly related to the changed behavior of jQuery .attr and .prop methods, which changed in jQuery 1.6 and 1.6.1. Basically .attr is for setting and querying the initial checked state of a radio button or checkbox, but .prop reflects the current checked state.

The issue is explained in detail here: http://blog.jquery.com/2011/05/12/jquery-1-6-1-released/

I was able to solve this with jQuery 1.6 by changing .attr to .prop in the checkboxradio plugin where the vclick function is bound to the label.

This issue is directly related to the changed behavior of jQuery .attr and .prop methods, which changed in jQuery 1.6 and 1.6.1. Basically .attr is for setting and querying the initial checked state of a radio button or checkbox, but .prop reflects the current checked state.

The issue is explained in detail here: http://blog.jquery.com/2011/05/12/jquery-1-6-1-released/

@ghost ghost assigned scottjehl Jun 7, 2011

@scottjehl

This comment has been minimized.

Show comment
Hide comment
@scottjehl

scottjehl Jun 8, 2011

Contributor

I just looked into this one a bit. It looks like we're using prop already, and I'm not seeing any noticeable issues with change events firing. is this fixed then?

Demo here: http://jsbin.com/ivoki4/3/edit

Contributor

scottjehl commented Jun 8, 2011

I just looked into this one a bit. It looks like we're using prop already, and I'm not seeing any noticeable issues with change events firing. is this fixed then?

Demo here: http://jsbin.com/ivoki4/3/edit

@scottjehl

This comment has been minimized.

Show comment
Hide comment
@scottjehl

scottjehl Jun 8, 2011

Contributor

closing this as I can't find a problem now. Let us know! Thanks

Contributor

scottjehl commented Jun 8, 2011

closing this as I can't find a problem now. Let us know! Thanks

@scottjehl scottjehl closed this Jun 8, 2011

@mobilizer

This comment has been minimized.

Show comment
Hide comment

FIXED! :)

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