Comments (2)
Yes this behavior will change in version 5.
from react-hotkeys-hook.
After a little bit of experimentation I think this might be a case of scope behaviour being a little unintuitive.
When setting the initiallyActiveScopes
to {["none"]}
I can see that the a
hotkey (unscoped) still triggers, but the m
hotkey (scoped to "tens") no longer does.
I think what's happening is that even though the wildcard scope *
is no longer in the active scopes collection, any hotkey that is in the wildcard scope still runs, this kind of makes sense but is a little unintuitive.
From this perspective I can sort of see why my scoped hotkey was running when the wildcard scope was active (no initiallyActiveScopes
set), because the wildcard scope matches all hotkeys.
I guess I was under the impression that the wildcard scope behaved just like every other scope, and therefore when it wasn't active, hotkeys that were unscoped would also be disabled.
I suppose then, the way to achieve the behaviour I'm after would be to ensure that none of my hotkeys are in the wildcard scope (unless I truly want them available at all times), and to ensure that I set the initiallyActiveScopes
to be the ones I consider to be "global".
tl;dr:
- The wildcard scope is always technically active, even if it doesn't appear in the active scopes collection
- Hotkeys that aren't explicitly scoped belong to the wildcard scope, and therefore are always available
- Scoped hotkeys are also in the wildcard scope, but only in the specific circumstance where the wildcard scope is in the active scopes collection
- This is where the unintuitive behaviour comes from
from react-hotkeys-hook.
Related Issues (20)
- slash, backslash, and bracketright are not defined correctly in parseHotkeys.ts HOT 9
- [BUG] meta on Mac does not capture cmd like the docs say HOT 3
- What is v4.5.0? HOT 1
- [BUG] Working locally, but not in production HOT 7
- [BUG]The keyboard combination doesn't work in focused input HOT 2
- [PSA] You probably want `equal` instead of `+` (plus/bracketright) HOT 2
- The useRecordHotkeys hook should allow us to programatically set the keys HOT 1
- [BUG] Does not handle the 'Alt Graph' modifier key HOT 1
- Match a key pressed by character (optionally maybe) instead of keyCode HOT 1
- [BUG] Hotkeys stuck on `contextmenu` event. HOT 1
- Several entries in mappedKeys look suspicious HOT 2
- [BUG] preventDefault seems not work when use `command + s ` HOT 2
- [BUG] Why is # key mapped to Backslash HOT 1
- [BUG] Callback called on each matched key in array HOT 3
- [BUG] hotKeys trigger from input inside WebComponent HOT 2
- [BUG] isHotkeyPressed requires ALL buttons to be pressed, not just at least one
- [BUG] v5.0.0-1, "useKey" option also seems to (partially) activate "ignoreModifiers" HOT 3
- [BUG] don't trigger hot keys when input focus HOT 1
- [BUG] `mod` modifier listens to `ctrl` on macOS HOT 5
- [BUG] document property of options param in useHotkeys method not working
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-hotkeys-hook.