Skip to content

Keystrokes in place of KeyboardJS #2664

@prescottprue

Description

@prescottprue

Is your feature request related to a problem? Please describe.
Not a problem, just that author of KeyboardJS says to leverage Keystrokes in place of KeyboardJS for new projects:

I've create a new libary called Keystrokes which serves the same purpose as KeyboardJS, but is more refined, and takes full advantage of modern browsers. If you are considering using KeyboardJS in a new project, I recommend checking out Keystrokes first.

Describe the solution you'd like

A hook similar to useKeyboardJs which uses Keystrokes:

import useKeystrokes from 'react-use/lib/useKeystrokes';

const Demo = () => {
  const [isPressed] = useKeyboardJs('a + b');

  return (
    <div>
      [a + b] pressed: {isPressed ? 'Yes' : 'No'}
    </div>
  );
};

useKeyboardJs could remain for now, but might be worth starting path to deprecation, but that is up to the author

Describe alternatives you've considered
Pretty straightforward support

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions