roam-toolkit
roam-toolkit copied to clipboard
Consider hotkey libraries other than react-hotkeys
roam-toolkit currently uses https://github.com/greena13/react-hotkeys to listen to keys.
It works well for the most part, but various bugs made vim style bindings harder to implement:
- https://github.com/greena13/react-hotkeys/issues/234
- https://github.com/greena13/react-hotkeys/issues/249
- https://github.com/greena13/react-hotkeys/issues/229
- https://github.com/greena13/react-hotkeys/issues/255
Also, react-hotkeys is no longer actively maintained.
This deliverable here would be evaluating other options, and seeing how much there is to be gained by switching.
Other options:
https://github.com/ccampbell/mousetrap
- Seems moderately/low activity? Decent number of old open issues
https://github.com/jaywcjlove/hotkeys
- The API doesn't have key sequences built it
- I personally find the DX of react-hotkeys a little more convenient.
Help maintain react-hotkeys
Roll our own hotkey library
I've used mousetrap in the past, with no issues. Not very complex usage though (no keychords etc) but actively used as core feature of my app for several years.
react-hotkeys v1.x uses mousetrap, and had reached a very stable state before v2 was published.
Another vote for mousetrap here. Though, it does have some smelly bits. For example, when developing my todoist-shortcuts browser extension, I noticed that it has an arbitrary time limit of 1 second for completing a key sequence, so my fork removes that.
@mgsloan the details of the underlying library are mostly abstracted away. So I don't think the dev experience would differ that much between the options.
https://github.com/roam-unofficial/roam-toolkit/blob/master/CONTRIBUTING.md introduces some overview of current code structure and conventions. Would be happy to answer more detailed questions on that as-well (reply mostly to previous version of the comment ;) )
Cool, thanks for the info @Stvad. I'd edited my comment because I realized this isn't the spot to discuss my rather idiosyncratic case, which is instead tracked by #91