Skip to content

Conversation

@buhodev
Copy link

@buhodev buhodev commented Nov 17, 2025

fixes: #1894

@changeset-bot
Copy link

changeset-bot bot commented Nov 17, 2025

⚠️ No Changeset found

Latest commit: df893ed

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Nov 17, 2025

built with Refined Cloudflare Pages Action

⚡ Cloudflare Pages Deployment

Name Status Preview Last Commit
bits-ui ✅ Ready (View Log) Visit Preview df893ed

@huntabyte
Copy link
Owner

Could you not just pass type="submit" to the checkbox?

@huntabyte
Copy link
Owner

I think we just don't prevent default when enter is pressed if type="submit" seems like a simpler fix here

@huntabyte
Copy link
Owner

huntabyte commented Nov 19, 2025

Ah but I guess that would still strigger a "click" event on the button thus changing the state, so this solution might be best after all. I do still think we should detect the type prop and only submit if it's type="submit"

@buhodev
Copy link
Author

buhodev commented Nov 19, 2025

Ah but I guess that would still strigger a "click" event on the button thus changing the state, so this solution might be best after all. I do still think we should detect the type prop and only submit if it's type="submit"

yes exactly, the click event is detected instead. ok I will update the code to reflect that change

@buhodev
Copy link
Author

buhodev commented Nov 19, 2025

wait, don't you think that having the type="submit" is irrelevant for this usecase? in svelte it's possible to submit the form when pressing "Enter" on a checkbox even without the type="submit".

demo

@huntabyte
Copy link
Owner

wait, don't you think that having the type="submit" is irrelevant for this usecase? in svelte it's possible to submit the form when pressing "Enter" on a checkbox even without the type="submit".

You're comparing an <input type="checkbox" /> to a Bits UI checkbox which renders a <button> to support tri-state.

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.

Mirror vanilla html input of type checkbox behaviour for submitting forms

2 participants