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

Ability to set prev and next keys #4

Closed

Conversation

kunukn
Copy link
Contributor

@kunukn kunukn commented May 19, 2021

I have a use case where I want to use the up and down keys for the previous and next focus.

API usage example

rovingIndex({
  element: document.querySelector('#vertical-accordions'),
  target: '.toggle',
  prev: ['ArrowUp'],
  next: ['ArrowDown'],
})

@argyleink
Copy link
Owner

nice, great feature request!
what do you think of setting direction instead of passing arrays with strings?

rovingIndex({
  element: document.querySelector('#vertical-accordions'),
  target: '.toggle',
  direction: 'vertical',
})

internally, 'vertical' would use the up/down arrows to move through the targets. horizontal would be default.

OR

what if the library mapped up/down arrow keys to left/right, so direction didnt matter? down and right are the same, and up and left are the same? "just works."

@kunukn
Copy link
Contributor Author

kunukn commented May 20, 2021

Sounds better than my suggestion :)

I like this one

what if the library mapped up/down arrow keys to left/right, so direction didnt matter? down and right are the same, and up and left are the same? "just works."

@kunukn
Copy link
Contributor Author

kunukn commented May 20, 2021

I have created this alternative PR

#5

@argyleink
Copy link
Owner

closing as the feature merged in the other PR!

@argyleink argyleink closed this May 20, 2021
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.

None yet

2 participants