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

[bug]: Formlabel does not close Popover of Combobox #6309

Open
2 tasks done
kamami opened this issue Jan 9, 2025 · 2 comments
Open
2 tasks done

[bug]: Formlabel does not close Popover of Combobox #6309

kamami opened this issue Jan 9, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@kamami
Copy link

kamami commented Jan 9, 2025

Describe the bug

I am using a Combobox in a Form. When the Popover is already open, clicking the Formlabel closes the Popover and opens it immediately. I would expect that clicking the Formlabel when the Popover is already open, closes the Popover.

Bildschirmaufnahme.2025-01-09.um.11.09.53.mov

Affected component/components

Combobox, Form, Formlabel

How to reproduce

Use the official example and click on the Formlabel two times. https://ui.shadcn.com/docs/components/combobox#form

Codesandbox/StackBlitz link

No response

Logs

No response

System Info

Google Chrome for MacOS

Before submitting

  • I've made research efforts and searched the documentation
  • I've searched for existing issues
@kamami kamami added the bug Something isn't working label Jan 9, 2025
@chintan8320
Copy link

It's essentially a race condition between these events
Click FormLabel → Close Popover → Activate Button → Open Popover

@chintan8320
Copy link

chintan8320 commented Jan 10, 2025

To fix this:

Break the label association by adding htmlFor="" to prevent the automatic control activation

<FormLabel htmlFor="">Language</FormLabel>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants