question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Discussion] Roadmap to Version 4

See original GitHub issue

👋 Announcing Version 4

I am currently overhauling the docs and while writing new and extensive documentation and tutorials on the hook, I realized a lot of shortcomings that are based on the fact that I never planned this to be a popular hook.

This is why I’d like to write out a roadmap to Version 4 that should address all those issues including its own basis on registering hotkeys instead of relying on an external package.

Version 4 will target modern browsers (otherwise writing and maintaining a hotkeys handling basis would be too time consuming), so there is a chance that some users will be stuck on version 3. To minimize the pain I’d like to hear from you what some of your pain points are when using the hook (what you think is confusing, what doesn’t work as expected, what could be improved, etc), what you would like to see as new features and in which context (browser support, etc) you are using the package. Thank you all in advance 😊

🚧 Current Problems

  • Handling of the alt modifier is complicated
  • There is no support for scopes #290
  • The API is cluttered with inconsistencies (filter, enable seem counterintuitive)
  • The + key is not working when using a different splitKey #544
  • ~You cannot use key codes~
  • Doesn’t work with React Portals #405
  • enableOnTags is not very intuitive if you don’t use TypeScript since you need to know that you have to type out the tag names in capital letters
  • enableOnTags should at least be case-insensitive.
  • The meaning of the return of filter is currently inversed. Returning false prevents the callback from getting executed, true bypasses the filter.
  • Exposing hotkeys.isPressed as a hook is unnecessary.
  • isHotkeyPressed should be able to take a combination of keys.
  • onKeyDown and onKeyUp doesn’t trigger correctly. If the key stays down, it triggers multiple times, should only trigger once

🎯 Goals for Version 4

  • All current features should be preserved
  • Drop hotkeys.js package
  • Only target modern browsers
  • Support scoping
  • Support Portals
  • Clean up API
  • Add a function which returns all currently pressed keys
  • Add a function which returns all currently bound hotkeys
  • Bind events to ref element otherwise to document
  • Set up CI/CD pipeline for publishing

🏗️ Track of V4 API changes

  • Merge filter into enabled
  • Rename splitKey to combinationKey
  • splitKey refers to the actual splitting of multiple hotkeys
  • Make the options object and dependency array interchangable
  • Allow the first parameter to be an array.
  • Add scopes option to options object
  • Add preventDefault to the options object
  • Replace any[] as dependency type with DependecyList
  • cmd/command becomes meta
  • enableOnTags now accepts a boolean (if set to true, all input tags are enabled)
  • enableOnTags becomes enableOnFormTags
  • isHotkeyPressed takes an array or string as first argument
  • isHotkeyPressed takes a splitChar as an optional second argument (defaults to ,)

🐛 Bugs

  • Nested Scoping doesn’t work
  • Arrow keys (down, left, etc.) aren’t mapped to ArrowDown, ArrowLeft, etc.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:40
  • Comments:26 (13 by maintainers)

github_iconTop GitHub Comments

3reactions
JohannesKlausscommented, Jul 22, 2022

@devinhalladay and every body else who are eager to try out the new version: A pre release is now available under either next or 4.0.0-1

I didn’t had any time to rewrite the readme yet, so usage is visible in the tests here: https://github.com/JohannesKlauss/react-hotkeys-hook/blob/feature/version-4/tests/useHotkeys.test.tsx

Or just have a look at the source code here: https://github.com/JohannesKlauss/react-hotkeys-hook/blob/feature/version-4/src/useHotkeys.ts

Please let me know if you encounter any strange behavior and/or bugs.

Please note that there are quite some breaking changes involved, so please check the API changes above (https://github.com/JohannesKlauss/react-hotkeys-hook/issues/574#issue-951354306) first

I am also happy to say that I am nearing feature completeness (only portal functionality is missing).

If you want to use the new Scoping feature to group hotkeys together (and activate/deactivate scopes programmatically) you have to wrap your app with <HotkeysProvider>

3reactions
JohannesKlausscommented, Feb 15, 2022

Hey everybody, I finally have the resources to work on version 4. So if you have any specific features in mind, wishes, improvements, etc. now is the time to let me know 😃

I can’t give a timeline yet, but I hope to release a candidate around march. If anybody has experience in writing documentation and is willing to help me out, I’d love to take it, because this is the tedious part as I learnt the last time.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Roadmap for version 4 · Issue #3649 · vuejs/vue-cli - GitHub
It's time for a major version bump. This will be a relatively small release but will include a number of necessary breaking changes....
Read more >
VCS VERSION 4 CONSULTATION ROADMAP | Verra
This VCS Version 4 Consultation Roadmap is designed to advance ... discussion about the relationship between voluntary and compliance.
Read more >
Roadmapping: Your starter guide - AHA.io
This video shows how to create roadmaps for your team using Aha! product roadmap ... You can show direction, visualize timing, and discuss...
Read more >
Who Should Participate in Product Roadmap Planning?
A roadmap is a guiding strategic document as well as a plan for executing the ... Discuss the timeframes, resources, and levels of...
Read more >
nopCommerce 4.50 Roadmap Discussion
Hello Folks, Its a best time to start discussion about what will be in 4.5 version :) Features are ready for 4.5 :)...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found