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

arrow keys wrap around #57

Merged
merged 4 commits into from
Nov 16, 2022
Merged

arrow keys wrap around #57

merged 4 commits into from
Nov 16, 2022

Conversation

Kilian
Copy link
Contributor

@Kilian Kilian commented Oct 26, 2022

Allows the arrow keys to wrap around, so when you press "up" from the input you end up at the bottom item, and when you press down while the last item is selected, it wraps around back to the first item in the list.

Fixes #56.

@vercel
Copy link

vercel bot commented Oct 26, 2022

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

Name Status Preview Updated
cmdk-website ✅ Ready (Inspect) Visit Preview Nov 10, 2022 at 2:47PM (UTC)

@peduarte
Copy link

I like this, but could this be done via a prop? Radix uses the loop prop for this https://www.radix-ui.com/docs/primitives/components/dropdown-menu#content

@Kilian
Copy link
Contributor Author

Kilian commented Oct 31, 2022

@peduarte you mean make it optional based on a loop prop? Where should it live, Command.Dialog or Command.List?

@pacocoursey
Copy link
Owner

Let's add an optional loop prop to the Command top-level component for this behavior 👍

@peduarte
Copy link

Yeah, I meant an optional loop prop. I'd personally add it to the List Component, since that's where the looping happens. But if @pacocoursey wants to add it to the Command component I'm down

@Kilian
Copy link
Contributor Author

Kilian commented Nov 1, 2022

loop prop added.

@peduarte
Copy link

very nice

@pacocoursey pacocoursey merged commit 994dea6 into pacocoursey:main Nov 16, 2022
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.

Wraparound when using arrow keys
3 participants