Skip to content

[BUG] Scoped hotkeys still trigger when scope is not active #1058

Open
@ckpearson

Description

@ckpearson

Describe the bug
When creating a hotkey and setting the scopes option to restrict the hotkey to a specific scope, the hotkey triggers regardless of what the active scope is.

In fact, I'm not even sure the scope is being set against the hotkey as when the context's hotkeys collection is dumped there isn't any scopes value against it.

To Reproduce
Repro codesandbox here: https://codesandbox.io/s/react-hotkeys-hook-scopes-not-working-yny6kl?file=/src/App.tsx

Expected behavior
I would expect the scoped hotkey to only trigger when one of the scopes it is set to use is active

Screenshots
N/A

Desktop (please complete the following information):
N/A - happens across windows & osx in chrome & safari

Metadata

Metadata

Assignees

No one assigned

    Labels

    Version 5.xThese tickets will be solved in Version 5.x

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions