Skip to content
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

Always render hidden inputs #2977

Closed
hauptrolle opened this issue Feb 9, 2024 · 4 comments · Fixed by #3095
Closed

Always render hidden inputs #2977

hauptrolle opened this issue Feb 9, 2024 · 4 comments · Fixed by #3095
Assignees

Comments

@hauptrolle
Copy link

What package within Headless UI are you using?

@headlessui/react

What version of that package are you using?

v2.0.0-alpha.4

What browser are you using?

Chrome

Describe your issue

With the current behaviour of the switch & checkbox component, the hidden checkbox is just rendered when the checkbox is checked.

This makes it pretty hard to implement these controls within a form framework like conform or submitting a form onChange (the input is visible after the form is submitted).

Would it be possible to always render the hidden checkbox input?

@hauptrolle
Copy link
Author

react-aria-components for example render always the hidden checkbox: https://react-spectrum.adobe.com/react-aria/Checkbox.html#html-forms

@RobinMalfait
Copy link
Member

Hey!

This should be fixed by #3095, and will be available in the next release.

You can already try it using:

  • npm install @headlessui/react@insiders.

@hauptrolle
Copy link
Author

Hey, I just tries out the insiders build. The checkbox is now always rendered, but a click on the checkbox does not trigger the forms native onChange event. Is this the intended behaviour?

@hauptrolle
Copy link
Author

@RobinMalfait Any updates on this? This is kind of a critical bug :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants