Repository navigation
fix(#4450): give Selector trigger an accessible name via aria-labelledby - #4604
gonzoblasco wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
97831a5 to
9da9552
Compare
There was a problem hiding this comment.
(Sorry the original comment was posted accidentally by AI, now updated with verified feedbacks)
Thanks for the fix. Two things to address:
- This branch also includes the unrelated contrast-token changes and audit scripts from #4022. Please rebase or cherry-pick the Selector commit onto main.
- Before this patch, the native association already gives the trigger the accessible name Fruit in the repository’s accessibility tests, across both hasSearch modes. Could you document the specific compatibility case where explicit aria-labelledby is needed, and add a regression if the tooling can represent it?
…elledby The Selector trigger button had no accessible name in either mode: - Without hasSearch: role=combobox (not name-from-content), no aria-label/aria-labelledby -> empty name - With hasSearch: plain button, name fell back to placeholder text instead of the actual label Fix: generate a fieldLabelId with useId(), pass it to Field as labelID, and use it as aria-labelledby on the trigger button when standalone (no InputGroup). For InputGroup mode the existing ariaLabelledBy composition is preserved.
9da9552 to
6efdf41
Compare
|
Thanks for the thorough review, @imdreamrunner. You're right on both counts. The branch is now clean - I rebased the Selector commit onto current main, so #4604 only contains the single aria-labelledby change to Selector.tsx (the contrast work from #4022 is no longer in this branch). On the accessible name finding: you're correct that the change is redundant. The evidence came from automated static audit (axe), not from a real browser/AT failure, and your verification confirms the native Thanks for the detailed review. |
What
Fixes #4450 — the Selector trigger button had no accessible name in either mode:
hasSearch:role=combobox(not name-from-content), noaria-labeloraria-labelledby→ empty accessible namehasSearch: plain<button>(name-from-content), but the name fell back to the placeholder text instead of the actuallabelpropChanges
fieldLabelIdwithuseId()in the Selector<Field>aslabelIDso the rendered label element carries a stableidaria-labelledbyon the trigger button when standalone (no InputGroup)ariaLabelledBycompositionValidation
pnpm test -- --run packages/core/src/Selector/Selector.test.tsx: 46/46 tests passpnpm lint: cleanpnpm check:sync: cleanpnpm check:package-boundaries: cleanFixes #4450