Skip to content

[BUG] callback gets call incorrectly with incorrect key #158

Description

@aprilmintacpineda

Describe the bug

The callback gets called incorrectly on mac.

Example code

keyboardJS.bind('c', () => console.log('c called!'));
  • When I press c, it gets called, which is correct.
  • When I press shift + c, it gets called, which is incorrect.
  • When I press command + c, it gets called, which is incorrect.

Here: https://jsfiddle.net/p7Lbz9uh/

Expected behavior

  • When I press shift + c, the callback should not be called.
  • When I press command + c, the callback should not be called.

Enviroment (please include the following info):

  • OS: macOS
  • Browser: Chrome@latest
  • Version: Not sure what to put here.

Additional context

When I do:

keyboardJS.bind('c', () => console.log('c got called!'));
keyboardJS.bind('command + c', () => console.log('command + c got called!'));

The correct callback gets called, but shift + c will still say c got called!, but when I do:

keyboardJS.bind('c', () => console.log('c got called!'));
keyboardJS.bind('command + c', () => console.log('command + c got called!'));
keyboardJS.bind('shift + c', () => console.log('shift + c got called!'));

The bug is not existent. https://jsfiddle.net/p7Lbz9uh/1/

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions