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

A11y Bug: Select.Trigger does not correctly pass id to hidden select, breaking Label semantic association #3294

Open
JRhodes95 opened this issue Dec 17, 2024 · 1 comment

Comments

@JRhodes95
Copy link

Bug report

Current Behavior

When using the Select primitives with the Label primitive or a html label element, passing an id to the Select.Trigger and a htmlFor to the Label or label does not create a semantic link between the Label and the Select.

This throws issues in automated A11y tooling (Wave shown in screenshots below).

CleanShot 2024-12-17 at 15 59 03@2x
CleanShot 2024-12-17 at 15 59 27@2x
CleanShot 2024-12-17 at 15 59 49@2x
CleanShot 2024-12-17 at 15 59 57@2x

Expected behavior

I had expect this to create the semantic link, adding the id to the hidden select element.

Reproducible example

CodeSandbox repro
I had to install a few packages, but this is mostly just your examples from the Select docs with one addition to allow me to pass an id to the SelectDemo component.

Suggested solution

Make the Select.Trigger pass the id correctly?

Additional context

I have come across similar issues before where you folks have well reasoned examples to go around the automated or MDN recommendations for semantic HTML to provide better a11y for actual cases you've tested - perhaps this is one of those?

Your environment

Software Name(s) Version
Radix Package(s) react-select 2.1.4
React n/a 17 (your sandbox) & 18 (our design system)
Browser chrome Version 131.0.6778.140 (Official Build) (arm64)
Assistive tech Wave
Node n/a 20.8.0 (design system)
npm/yarn yarn (design system) 4.0.2
Operating System MacOS 14.7.1 (23H222)
@JRhodes95
Copy link
Author

Could this be related - #2836 ?

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

1 participant