JohannesKlauss / react-hotkeys-hook

React hook for using keyboard shortcuts in components.
https://react-hotkeys-hook.vercel.app/
MIT License
2.68k stars 114 forks source link

`useHotkeysContext` is missing in docs #1104

Open kachkaev opened 10 months ago

kachkaev commented 10 months ago

Is your feature request related to a problem? Please describe.

I bumped into this library and loved its design. It took me a bit of time to discover useHotkeysContext() and its ability to list all registered keys. First, I found https://github.com/JohannesKlauss/react-hotkeys-hook/pull/972 by @zenzen-sol, then explored the source:

https://github.com/JohannesKlauss/react-hotkeys-hook/blob/f5e0dddc2633b8a8e244e11c6ee8ffcee4a46ed5/src/HotkeysProvider.tsx#L7

Without this, I would not know about the ability to call const { hotkeys } = useHotkeysContext() which seems to be perfect for showing a list of shortcuts (or at least debugging it).

Describe the solution you'd like I’d expect to find useHotkeysContext() in https://react-hotkeys-hook.vercel.app/docs/intro. It’d be also good to see a note on hotkeys in README.md. This file mentions the hook but not its ability to return a list of registered shortcuts.

Describe alternatives you've considered Browsing issues and code

Additional context Great lib 💯 👏

JohannesKlauss commented 9 months ago

True, we could add this a bit more prominently in the docs. If you find any time I'd happy to approve a PR to the docs :)

kachkaev commented 9 months ago

👋 @JohannesKlauss, thanks for paying attention to this issue! I don’t have spare capacity ATM, so it’d be great if someone else could pick it up. Hope that the issue description gives a bit of guidance. Cheers!