Open onx2 opened 3 months ago
What is your use case for that? I’m not entirely opposed to the idea, but it might be a specific need for your app, and like you see is not hard to figure out that functionality yourself.
I'm creating a keyboard shortcut manager for an application and want to allow a user to define keys bound to an action. Normally when triggering keybindings in software, for example VSCode, Notion, and many others, I can press at least the Modifier Keys
in any order then a Character Key
to trigger an action. You can see an example of this in VSCode with Shift + CMD + P
or in Notion with Shift + CMD + L
. I actually expected the default behavior of createShortcut
to do this as it is very commonplace, at least in the software / apps I use. I'm happy to contribute to this as well!
Edit: As you mentioned above, this isn't difficult to create using the existing functions but I will admit I was a bit confused when createShortcut
didn't have this behavior. If you think that it is best to keep it out I can close this and implement a custom function in my app instead - thanks for your time!
Describe The Problem To Be Solved
This may not be a bug, and if not I think it would be a nice thing to add as another function or option.
I want to use
createShortcut(["Shift", "Control", "M"], () => {})
and have it trigger the function on any permutation of key presses, so how vscode does it with their shortcuts.Suggest A Solution
I have a rough implementation of it using
useKeyDownList
, so something like this but maybe with also a length check?