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

Plans for a useHotkeys hook? #210

Open
jordantomax opened this issue Jul 18, 2019 · 6 comments
Open

Plans for a useHotkeys hook? #210

jordantomax opened this issue Jul 18, 2019 · 6 comments

Comments

@jordantomax
Copy link

Is your feature request related to a problem? Please describe.
I love that hooks make functional components possible for just about everything. I also love react-hotkeys because of its lack of dependencies and it's options to present active hotkeys information to the user.

Describe the solution you'd like
Would love to get a useHotkeys option for react hotkeys.

Describe alternatives you've considered
Looked into the existing https://github.com/JohannesKlauss/react-hotkeys-hook which is just a super simple wrapper around hotkeys-js library. Seems okay, but doesn't seem as well maintained and doesn't have the ability to present the user with a menu of registered hotkeys

Really just trying to gauge plans/interest to build such a feature.

@greena13
Copy link
Owner

Hi @jordantomax,

I'd have to look into what's involved, but I'm open to the idea of supporting it. It seems to be the direction react is headed, so react-hotkeys should endeavour to support and remain consistent with that.

@amcdnl
Copy link

amcdnl commented Oct 16, 2019

@greena13 - Any updates on this? I too would like to take advantage of hooks with this library!

@softmarshmallow
Copy link

We need this.! This library needs update

@d-e-v-esh
Copy link

Would love to contribute to this. That would be amazing.

@amcdnl
Copy link

amcdnl commented Feb 12, 2021

I ended up writing my own library - https://github.com/reaviz/reakeys

@kachkaev
Copy link

kachkaev commented Dec 7, 2023

react-hotkeys-hook seems to be catching up:

Screenshot 2023-12-07 at 15 02 04

Download stats for react-hotkeys (🟢) decline quite quickly at the start of 2021. Does anyone know where all those downloads go? I wonder if there are any other alternatives worth exploring.


@jordantomax to your point on

[react-hotkeys-hook] doesn't have the ability to present the user with a menu of registered hotkeys

They seem to support this now via const { hotkeys } = useHotkeysContext();. You can provide descriptions to your hotkeys and then list them in some kind of a menu. The docs for this feature are missing though (JohannesKlauss/react-hotkeys-hook#1104).

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

No branches or pull requests

6 participants