timc1 / kbar

fast, portable, and extensible cmd+k interface for your site
https://kbar.vercel.app
MIT License
4.84k stars 185 forks source link

[feature]: Allow looping when navigating the results list #224

Closed AkashRajpurohit closed 2 years ago

AkashRajpurohit commented 2 years ago

When a user reaches the end of the list, on pressing the ArrowDown the list selection does not move back to the first item.

We can add a feature to allow the list to continue the looping when it reaches the end of either side of the list, i.e. go to first item when clicked ArrowDown on last item and go to last item when clicked ArrowUp on first item.

We can take an optional prop for the KbarResults, something like allowLoop and maintain backward compatibility by having its default value as false which is the current behavior. When set to true, we can enable the flow mentioned above.

If this is something you feel can add value to the package, I can work on this feature and send a PR :)

benatpigment commented 2 years ago

+1 for this feature

AkashRajpurohit commented 2 years ago

@benatpigment If you would like to review, I have created an PR for adding this #226 :)

stale[bot] commented 2 years ago

Hey! This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.