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] Disabling scopes doesn't work if there's only one scope #908

Open
roryschadler opened this issue Jan 10, 2023 · 4 comments
Open

[BUG] Disabling scopes doesn't work if there's only one scope #908

roryschadler opened this issue Jan 10, 2023 · 4 comments
Labels
good first issue Good for newcomers Version 5.x These tickets will be solved in Version 5.x

Comments

@roryschadler
Copy link

Describe the bug
When only one scope is enabled, disabling that scope has the effect of enabling all scopes.

To Reproduce

  1. Set up a hotkey with one scope.
  2. Get to a state with only that scope enabled (such as defining it as the only initial scope in <HotkeysProvider />).
  3. Disable that scope.
  4. See that the hotkey still works, despite its one scope being disabled.

Please try and add a codesandbox or stackblitz to reproduce the bug:
https://codesandbox.io/s/laughing-zhukovsky-vnrqlj?file=/src/App.js

Expected behavior
Disabling the scope of a hotkey should disable the hotkey. And the behavior where disabling all scopes is the same as enabling all scopes is confusing (at least to me).

Desktop (please complete the following information):

  • OS: macOS
  • Browser chrome v108
  • Version 4.3.2
@JohannesKlauss
Copy link
Owner

Duplicate of #854 (comment)

But I do agree that this is a bit unintuitive and disabling all scopes should result in disabling all scopes.
Would you care to create a PR for that?

@Nantris
Copy link

Nantris commented Feb 15, 2023

@JohannesKlauss if this is a duplicate shouldn't this one be closed and #854 be opened?

@JohannesKlauss JohannesKlauss added Version 5.x These tickets will be solved in Version 5.x good first issue Good for newcomers labels Jun 23, 2023
@sandstone991
Copy link

sandstone991 commented Jun 25, 2023

Are you still considering having active scopes as an empty array instead of ["*"] when all scopes are disabled, so I can create a pull request to this? @JohannesKlauss

@JohannesKlauss
Copy link
Owner

Yes, you are absolutey welcome to create a PR for this. Since it is a breaking change this will be released in version 5

sandstone991 added a commit to sandstone991/react-hotkeys-hook that referenced this issue Jun 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers Version 5.x These tickets will be solved in Version 5.x
Projects
None yet
Development

No branches or pull requests

4 participants