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

[BUG] Handler triggers without completing full sequence - 2.0.0-pre5 #183

Closed
jordantomax opened this issue May 23, 2019 · 9 comments
Closed

Comments

@jordantomax
Copy link

Describe the bug
meta keys trigger events even when full sequence of keys has not been completed

Here's a sandbox of the issue: https://codesandbox.io/s/gracious-dhawan-3ncnw?fontsize=14

To reproduce, focus the input, then do the following:

  1. type 'command+enter' (this should trigger the log)
  2. type 'command' (this triggers the log but should not)

How are you using react hotkeys components? (HotKeys, GlobalHotKeys, IgnoreKeys etc)
HotKeys

Expected behavior
action only triggers when full sequence of keys is completed

Platform (please complete the following information):

  • Version of react-hotkeys: 2.0.0-pre5
  • Browser: brave browser (a flavor of chrome)
  • OS: MacOS 10.14.5

Are you willing and able to create a PR request to fix this issue?
Maybe!

APPLICABLE TO v2.0.0-pre1 AND ABOVE: ======================

Include the smallest log that includes your issue:

HotKeys (F0📕-E14💙-C0🔺-P0🔺:) Ignored 'Enter+Meta' keypress because it doesn't have any keypress handlers.
breadcrumbs.js:58 HotKeys (GLOBAL-E14💙): Received (simulated) 'Meta' keypress event (that has already passed through React app).
breadcrumbs.js:58 HotKeys (GLOBAL-E14💙): Key history: [
    {
        "keys": {
            "Enter": [
                [
                    true,
                    false,
                    false
                ],
                [
                    true,
                    true,
                    false
                ]
            ],
            "Meta": [
                [
                    true,
                    true,
                    false
                ],
                [
                    true,
                    true,
                    true
                ]
            ]
        },
        "ids": [
            "Enter+Meta"
        ],
        "keyAliases": {}
    },
    {
        "keys": {
            "Enter": [
                [
                    true,
                    false,
                    false
                ],
                [
                    true,
                    true,
                    false
                ]
            ],
            "Meta": [
                [
                    true,
                    false,
                    false
                ],
                [
                    true,
                    true,
                    false
                ]
            ]
        },
        "ids": [
            "Enter+Meta"
        ],
        "keyAliases": {}
    }
].
breadcrumbs.js:58 HotKeys (GLOBAL-E14💙): Ignored 'Enter+Meta' keypress because it doesn't have any keypress handlers.
breadcrumbs.js:58 HotKeys (F0📕-E15💛-C0🔺-P0🔺:) New 'Meta' keyup event.
breadcrumbs.js:58 HotKeys (F0📕-E15💛-C0🔺-P0🔺:) Key history: [
    {
        "keys": {
            "Enter": [
                [
                    true,
                    false,
                    false
                ],
                [
                    true,
                    true,
                    false
                ]
            ],
            "Meta": [
                [
                    true,
                    true,
                    true
                ],
                [
                    true,
                    true,
                    true
                ]
            ]
        },
        "ids": [
            "Enter+Meta"
        ],
        "keyAliases": {}
    },
    {
        "keys": {
            "Enter": [
                [
                    true,
                    false,
                    false
                ],
                [
                    true,
                    true,
                    false
                ]
            ],
            "Meta": [
                [
                    true,
                    true,
                    true
                ],
                [
                    true,
                    true,
                    true
                ]
            ]
        },
        "ids": [
            "Enter+Meta"
        ],
        "keyAliases": {}
    }
].
breadcrumbs.js:58 HotKeys (F0📕-E15💛-C0🔺-P0🔺:) Ignored 'Enter+Meta' keyup because it doesn't have any keyup handlers.
breadcrumbs.js:58 HotKeys (GLOBAL-E15💛): Received 'Meta' keyup event (that has already passed through React app).
breadcrumbs.js:58 HotKeys (GLOBAL-E15💛): Key history: [
    {
        "keys": {
            "Enter": [
                [
                    true,
                    false,
                    false
                ],
                [
                    true,
                    true,
                    false
                ]
            ],
            "Meta": [
                [
                    true,
                    true,
                    false
                ],
                [
                    true,
                    true,
                    true
                ]
            ]
        },
        "ids": [
            "Enter+Meta"
        ],
        "keyAliases": {}
    },
    {
        "keys": {
            "Enter": [
                [
                    true,
                    false,
                    false
                ],
                [
                    true,
                    true,
                    false
                ]
            ],
            "Meta": [
                [
                    true,
                    true,
                    false
                ],
                [
                    true,
                    true,
                    true
                ]
            ]
        },
        "ids": [
            "Enter+Meta"
        ],
        "keyAliases": {}
    }
].
breadcrumbs.js:58 HotKeys (GLOBAL-E15💛): Ignored 'Enter+Meta' keyup because it doesn't have any keyup handlers.

What Configuration options are you using?
None!

@jordantomax jordantomax changed the title [BUG] Handler triggers without completing full sequence [BUG] Handler triggers without completing full sequence - 2.0.0-pre5 May 23, 2019
@greena13
Copy link
Owner

greena13 commented Jun 2, 2019

Hi @jordantomax, thanks for the great write-up.

I think this may be fixed in v2.0.0-pre7. Are you able to confirm this is the case?

@julesbecker
Copy link

Hey @greena13 - I just tested with v2.00-pre7 (with GlobalHotkeys) and am having the same issue with meta+enter. Interestingly, when I change the non-meta key to something else (like "meta+b"), it no longer triggers with just the command key. Also, for the original meta+enter case, if I click away from the window and back, being able to trigger it with just "command" goes away.

@jordantomax
Copy link
Author

@greena13 thanks for the quick turnaround! And apologies for the delayed response, I’m traveling in Asia right now and internet is unreliable. I’ll take a look as soon as I’m with a computer and good internet and will confirm that the issue is fixed. Hopefully early next week. Thanks!!

@jordantomax
Copy link
Author

jordantomax commented Jun 13, 2019

@greena13 Unfortunately no dice 🎲. Bug is still affecting our app in 2.0.0-pre7, same as @julesbecker. Can we re-open?

@jordantomax
Copy link
Author

@greena13 Also updated the code sandbox with the latest version so you can reproduce there.

@greena13
Copy link
Owner

Apologies for the misunderstanding, @jordantomax. The fix for this has yet to be deployed (it's not in 2.0.0-pre7).

I have up until this point been using the fact that merging in bug fixes into master closes the corresponding issues to clear the backlog clear for myself, but I can see how it may cause confusion when the fixes have not necessarily become available. I am toying with the idea of using a separate release branch to avoid closing issues until they're solved in the latest version available.

In the meantime, the fix should be available in 2.0.0-pre8 when it's released (hopefully this weekend), or you can pull your dependency from this git repo as a temporary work around.

@jordantomax
Copy link
Author

@greena13 Ah! Testing off master does appear to fix the problem! 😄😄. I've actually disabled the specific feature in my app temporarily as I found another issue (which I created a Github issue for). I'll wait until we find a fix for that one to re-enable. So I'll wait for the new version over the weekend as it's less urgent. Thanks for the info.

@greena13
Copy link
Owner

Fix is now available in v2.0.0-pre8.

@jordantomax
Copy link
Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants