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

Consider hotkey libraries other than react-hotkeys #68

Open
tntmarket opened this issue May 22, 2020 · 5 comments
Open

Consider hotkey libraries other than react-hotkeys #68

tntmarket opened this issue May 22, 2020 · 5 comments
Labels
dependencies Pull requests that update a dependency file

Comments

@tntmarket
Copy link
Contributor

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:

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

@Stvad Stvad added the dependencies Pull requests that update a dependency file label May 23, 2020
@houshuang
Copy link

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.

@ZYinMD
Copy link

ZYinMD commented Jun 11, 2020

react-hotkeys v1.x uses mousetrap, and had reached a very stable state before v2 was published.

@mgsloan
Copy link

mgsloan commented Jun 14, 2020

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.

@Stvad
Copy link
Member

Stvad commented Jun 14, 2020

@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 ;) )

@mgsloan
Copy link

mgsloan commented Jun 26, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file
Projects
None yet
Development

No branches or pull requests

5 participants