pacocoursey / cmdk

Fast, unstyled command menu React component.
https://cmdk.paco.me
MIT License
9.42k stars 265 forks source link

Allow keyboard navigation even when text input is not focused #61

Closed glocore closed 6 months ago

glocore commented 1 year ago

Bug

When the search input is not focused, the navigation keys don't work as expected. In the screencap below, I click elsewhere inside the palette and press the up/down arrow keys, but it scrolls the list/page instead of navigating through the list items.

https://user-images.githubusercontent.com/24620401/199450737-08094588-e54a-40c2-aeb7-56b2b55d654c.mov

Fix

This fix allows the cmdk-root div to capture the navigation keybindings. This also allows the developer to use a custom search input outside the context of <Command>...</Command> (which is my use-case 😋)

vercel[bot] commented 1 year ago

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 Jan 30, 2024 4:30am
davidthomasparks commented 1 year ago

Any updates on this? We are experiencing the same issue.

OwenVey commented 11 months ago

Would love this feature as I am looking to exactly the same thing.

frixaco commented 9 months ago

Same here. Would love to have this feature

jinyang1994 commented 7 months ago

+1