-
-
Notifications
You must be signed in to change notification settings - Fork 340
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
Clicking on label for a select component opens it #1108
Comments
Hmm... isn't this the native/expected behaviour?
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label If you don't want this behaviour, remove the |
Native behavior with a It seems like the |
Hunh, you're right. TIL: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select But still, removing the Also, re-reading your issue, I can finally see the "not closing" it part. And I agree, it feels odd/wrong. Maybe Hunter will provide some context. |
So, when a label is associated with a button, the only option when clicking said label is to "click" the button. I tried researching to see if there is a way to determine if the 'click' event came from a select and came up empty-handed. |
The weirder issue is that clicking the label again doesn't close the select, but closes it and reopens it, as if it is being clicked twice (at least on chrome on windows) |
@olegpolin Yeah, this is because it is being registered as an "outside click" followed by a "click." Clicking the label is outside the content, causing the content to close, and then the label triggers a click on the button, which reopens it. I'll look into getting this resolved in the Svelte 5 version of Bits I'm currently working on. |
Got it, thanks |
Describe the bug
Clicking on a label for a select component triggers it, clicking it again doesn't close it. Is this intended behavior?
Reproduction
https://stackblitz.com/edit/shadcn-svelte-select-label
Logs
No response
System Info
Latest versions of everything
Tested on Chrome on Windows
On Android Chrome and IOS Safari, clicking the label still opens the select, but clicking the label again closes it.
Severity
annoyance
The text was updated successfully, but these errors were encountered: