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

[v2] Attempt form submission when pressing Enter on Checkbox component #2962

Merged
merged 3 commits into from
Feb 2, 2024

Conversation

RobinMalfait
Copy link
Member

@RobinMalfait RobinMalfait commented Feb 2, 2024

This PR fixes an issue where pressing Enter on a <Checkbox /> component didn't attempt to submit the form. This PR solves that.

The Checkbox component is a span to make it stylable which means that it doesn't have the native capabilities to submit a form (we do render a hidden input field for exposing the data to the parent form but it doesn't retrieve any events directly).

This now implements the same logic as the <Switch /> component where it attempts to submit the form.

Fixes: #2958

Copy link

vercel bot commented Feb 2, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
headlessui-react ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 2, 2024 2:47pm
headlessui-vue ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 2, 2024 2:47pm

@RobinMalfait RobinMalfait merged commit da94b80 into main Feb 2, 2024
8 checks passed
@RobinMalfait RobinMalfait deleted the fix/issue-2958 branch February 2, 2024 14:51
@reinink reinink changed the title Attempt form submission when pressing Enter on Checkbox component [v2] Attempt form submission when pressing Enter on Checkbox component Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[a11y]: Checkbox does not submit form on enter
1 participant