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
Link to x-posted issue in radix-ui (not sure which repo should I post to): radix-ui/primitives#3444
Suppose we have a form with 1 checkbox and 1 button, and that button has a formAction handler. When clicking the button, the handler is fed with a FormData object. If we select the checkbox, the 1st click to the button delivers its state in that FormData.
But if we click the button the 2nd time, FormData is delivered empty. The same happens in onSubmit handler of the
itself. This is all despite the checkbox itself is still visually on.
This happens, because formAction on a button resets the form. So it implicitly resets all of the checkboxes in the form to their default state. But visually, nothing changes, since rendering of the Checkbox state is independent on the actual <input type="checkbox"/> state.
Describe the bug
Link to x-posted issue in radix-ui (not sure which repo should I post to): radix-ui/primitives#3444
Suppose we have a form with 1 checkbox and 1 button, and that button has a formAction handler. When clicking the button, the handler is fed with a FormData object. If we select the checkbox, the 1st click to the button delivers its state in that FormData.
But if we click the button the 2nd time, FormData is delivered empty. The same happens in onSubmit handler of the
itself. This is all despite the checkbox itself is still visually on.This happens, because formAction on a button resets the form. So it implicitly resets all of the checkboxes in the form to their default state. But visually, nothing changes, since rendering of the Checkbox state is independent on the actual
<input type="checkbox"/>
state.CleanShot.2025-04-04.at.16.15.57.mp4
Affected component/components
Checkbox
How to reproduce
Codesandbox/StackBlitz link
No response
Logs
System Info
Before submitting
The text was updated successfully, but these errors were encountered: