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

Custom labels for combobox are missing the htmlFor property #3139

Open
eebabe opened this issue Apr 25, 2024 · 2 comments
Open

Custom labels for combobox are missing the htmlFor property #3139

eebabe opened this issue Apr 25, 2024 · 2 comments

Comments

@eebabe
Copy link

eebabe commented Apr 25, 2024

What package within Headless UI are you using?

@headlessui/react

What version of that package are you using?

v1.7.19

What browser are you using?

Chrome/Firefox

Reproduction URL

https://codesandbox.io/p/devbox/elastic-julien-97m3nj?file=%2Fsrc%2FApp.jsx%3A31%2C56

Describe your issue

When providing a custom label for a combobox, the rendered custom label is missing the htmlFor property which is needed for accessibility.

See examples at https://www.w3.org/WAI/GL/wiki/Using_aria-labelledby_to_concatenate_a_label_from_several_text_nodes

@adamwathan
Copy link
Member

Hey! The label is associated with the input using aria-labelledby to make sure the label is properly announced to screen readers:

image

Is there a specific issue you are seeing that we'd need to add htmlFor to solve?

@eebabe
Copy link
Author

eebabe commented Apr 25, 2024 via email

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

No branches or pull requests

2 participants