-
Notifications
You must be signed in to change notification settings - Fork 47.6k
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
Bug: Checked attribute does not update in the dom #24439
Comments
The current behavior is correct. The confusion stems from the browser reporting the attribute values. However, React sets the checked property on the DOM node. Setting a property is the correct way to update something — attributes are primarily meant to reflect the initial HTML that was loaded in the browser. React does update attribute in some cases, notably for inputs So the behavior for the |
For CSS selectors you'd want to use |
Isn't this an Accessibility issue? It's impacting a project I'm working on and am curious if there's a recommended work-around to update this attribute? |
React version:
Steps To Reproduce
Link to code example: https://codepen.io/gaearon/pen/wgedvV?editors=0010
The current behavior
dom does not update, the checked attribute stays no matter what.
same goes if the initial state is set to false, the checked attribute never appears on the input element.
The expected behavior
The checked attribute should be removed if not checked.
The text was updated successfully, but these errors were encountered: