-
Notifications
You must be signed in to change notification settings - Fork 48.5k
Radio buttons not working correctly #242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This happens because the change event never triggers on A, only on B -- React doesn't get a chance to restore the checked state. |
Paging @yungsters. |
For lack of a better place to put this fiddle: http://jsfiddle.net/KfqXH/1/ I spoke with @spicyj on IRC. There will be issues if you have:
This is an edge case we don't think needs to be handled (partly because there might not be a way for some browsers to even detect if an arbitrary A simple way to deal with this involves maintaining a list of all instantiated React radio inputs. Whenever one radio input's value changes, look for other radio inputs with the same By scope, I mean inputs within the same form or not inside any form. |
…-any Improve Flow coverage by reducing typecasts through `any`
Expected behavior would be for A to stay checked when B is clicked, but it's not the case.
jsFiddle
Similarly, here's a modified version that works on every subsequent click on B, but not the first time. If this helps, setting a timeout 0 around
this.refs.A.getDOMNode().checked = true
works (except it gives a flash when you click on B, which is less than ideal)The text was updated successfully, but these errors were encountered: