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

[Accessibility] Use id instead of children #254

Merged
merged 3 commits into from
Mar 14, 2025

Conversation

UltimateGG
Copy link
Contributor

Closes #253

Values were not being read aloud when selected with mouse, arrow keys, etc.
This is because:

  1. The aria-activedescendant was not being updated
  2. The element with the aria-activedescendant must be focused to read the value it references aloud

Finding the selected item was previously done using a querySelector and encodeUri which is bad because if children are used instead of a string, this will not serialize well (As well as spaces, special characters, etc.). The new approach is more robust and uses the actual ID in the dom.

The focus issue is solved by changing the focus back to the command input, or outer list container when the value is updated.

Copy link

vercel bot commented May 5, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
cmdk-website ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 14, 2025 6:25pm

@felix-schaffernicht-syzygy

Hi, this PR would solve the accessibility findings in our project. Will this be merged in the near future? Would be really appreciated!

@bkoca
Copy link

bkoca commented Feb 26, 2025

Same as @felix-schaffernicht-syzygy , merging this in will help address our accessibility issues when using it!

@mikeE-finsight
Copy link

Hey @UltimateGG, this is great thanks!

I'm not involved in this project but it looks like you have tests failing if you look at https://github.com/pacocoursey/cmdk/pull/254/files. I wonder if we get those fixed if this will get some attention.

@pacocoursey I'd be happy to pitch in here since accessibility is broken outright at the moment. Let me know how I can assist!

Thanks!

@pacocoursey pacocoursey merged commit 34f3074 into pacocoursey:main Mar 14, 2025
2 checks passed
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

Successfully merging this pull request may close these issues.

Accessibility: Items not read aloud
5 participants