You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bug: Controlled radio with uppercase type (e.g. type="RADIO") is not restored after click #38163
Controlled radio buttons whose type is not all lowercase (e.g. type="Radio" or type="RADIO") do not get restored to their controlled checked state after a click. HTML input types are case-insensitive and the browser treats these as normal radio buttons (input.type === 'radio'), but React skips restoring the other radios in the group. As a result, the DOM no longer matches React state.
React version: 19.3.1 (react and react-dom)
Steps To Reproduce
Render two controlled radio buttons in the same group with type="RADIO", where state keeps A selected and onChange does not change state.
Click B.
Link to code example:
import{useState}from'react';functionApp(){const[value]=useState('A');return['A','B'].map(option=>(<labelkey={option}><inputtype="RADIO"name="plan"checked={value===option}onChange={()=>{// Intentionally do not update state (e.g. the user cancelled a confirm dialog).}}/>{option}</label>));}
Results in Chrome after clicking B:
type
A / B checked after clicking B
radio
true / false
Radio
false / false
RADIO
false / false
The current behavior
With type="Radio" or type="RADIO", both A and B end up unchecked, even though state still selects A.
The expected behavior
Same as type="radio": B is unchecked and A stays checked, matching React state.
restoreControlledInputState in ReactDOMInput.js checks props.type === 'radio', so the group restoration is skipped when the prop is not lowercase. A fix using the browser-normalized rootNode.type is proposed in #38162.
This also affects native form serialization. I put the two controlled radios in a form with value={option} and left the change handler as a no-op. In React DOM 19.3.1 with jsdom, after clicking B with type="RADIO", new FormData(form).get('plan') returned null, even though the React selection was still A.
For apps that get input types from a schema, normalize the string before passing it to React (type={field.type.toLowerCase()}), or use the literal type="radio" in the radio renderer. With that normalization the change handler still fired once, A stayed checked, and FormData returned 'A'. Checking the serialized value would also make a useful end-to-end assertion for #38162.
@omerfarukgurbuz
Thanks for checking and highlighting the form serialization impact! This is consistent with the same checked-state restoration bug. The regression test in #38162 directly checks that A remains checked and B is unchecked after the click, which should also cover the underlying state that form serialization depends on.
Activity
omerfarukgurbuz commentedon Nov 9, 2026
This also affects native form serialization. I put the two controlled radios in a form with
value={option}and left the change handler as a no-op. In React DOM 19.3.1 with jsdom, after clicking B withtype="RADIO",new FormData(form).get('plan')returnednull, even though the React selection was still A.For apps that get input types from a schema, normalize the string before passing it to React (
type={field.type.toLowerCase()}), or use the literaltype="radio"in the radio renderer. With that normalization the change handler still fired once, A stayed checked, andFormDatareturned'A'. Checking the serialized value would also make a useful end-to-end assertion for #38162.lunaxislu commentedon Nov 10, 2026
@omerfarukgurbuz
Thanks for checking and highlighting the form serialization impact! This is consistent with the same checked-state restoration bug. The regression test in #38162 directly checks that A remains checked and B is unchecked after the click, which should also cover the underlying state that form serialization depends on.