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] - Select field label does not focus the component #4946

Open
smozely opened this issue Feb 27, 2025 · 9 comments
Open

[BUG] - Select field label does not focus the component #4946

smozely opened this issue Feb 27, 2025 · 9 comments
Labels
📦 Scope : Components Related to the components ✨ Type: Enhancement New enhancement on existing codebase

Comments

@smozely
Copy link
Contributor

smozely commented Feb 27, 2025

HeroUI Version

2.7.2

Describe the bug

Clicking on the label for the Select component doesn't open the picker. This is visible when using the "outside" label placement variants.

Visible in the HeroUI docs site

Your Example Website or App

https://www.heroui.com/docs/components/select#label-placements

Steps to Reproduce the Bug or Issue

  1. Click on the "Favorite Animal" label for the options where the label is outside-top or outside-left
  2. Nothing happens

Expected behavior

I am expecting the select dropdown to open

Screenshots or Videos

No response

Operating System Version

MacOS

Browser

Chrome

Copy link

linear bot commented Feb 27, 2025

@linyonglu
Copy link
Contributor

Could you record a video for me to have a look? I can't do it this way here.

@smozely
Copy link
Contributor Author

smozely commented Feb 27, 2025

Ok actually I might have this slightly wrong, standard behavior isn't that the select menu opens when the label is clicked. But it does give focus to the control, and in HeroUI it does nothing.

So this is behavior show via the HeroUI docs site (label click does nothing)
https://github.com/user-attachments/assets/a8a982a8-3acd-49d2-bd06-558a962571bb

vs this from say the react-aria-components docs (label click focuses the select)
https://github.com/user-attachments/assets/3cb4bf2c-1a37-49d3-81b1-040ee5860aab

or this from MDN on a normal native select (label click focuses the select - though their CSS makes it look odd)
https://github.com/user-attachments/assets/2e3cd325-f9f1-4e33-9bd6-e140bc474a20

@thee-pika
Copy link

I also noticed that clicking on the label does not open the associated select input. In many UI, clicking on the label is expected to focus or open the input for better usability and accessibility. Is this behavior intentional or not

@abhinav700
Copy link
Contributor

@wingkwong can I work on this issue?

@abhinav700
Copy link
Contributor

@wingkwong should we also trigger an hover on select when the label is hovered?

@wingkwong
Copy link
Member

@abhinav700 hovering shouldn't trigger it. The issue here is when clicking an label, the component should be focused.

@abhinav700
Copy link
Contributor

@wingkwong got it.

@abhinav700
Copy link
Contributor

@wingkwong I have become busy with some work and won't be able to work on this issue.
Can you unassign me please

@wingkwong wingkwong added ✨ Type: Enhancement New enhancement on existing codebase 📦 Scope : Components Related to the components labels Mar 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📦 Scope : Components Related to the components ✨ Type: Enhancement New enhancement on existing codebase
Projects
None yet
Development

No branches or pull requests

5 participants