pacocoursey / cmdk

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

How to focus on the last element by ArrowUp click? #259

Closed terlan4 closed 1 month ago

terlan4 commented 1 month ago

When the cmdk dialog pops up, it has focus on the first Command Item and with arrowDown you can focus on the 2nd and so on.. But when I press arrowUp, I would love to focus on the last command item on the list.

Also is there way of not having focus on the first item by default when the dialog opens? Thanks

davidmokos commented 1 month ago

Pass in loop prop into the Command like <Command loop />. This will move your cursor to the last item when you press arrow up

terlan4 commented 1 month ago

Thank you very much @davidmokos :)