-
Notifications
You must be signed in to change notification settings - Fork 160
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 for /
is getting called for ?
#161
Comments
Is there a way to turn off this sub-match feature? |
@FutureKode Not at the moment |
Hi @FutureKode, Apologies for the delay - I have been unable to carve out time to tend to this library as much as I would like, recently. Thank you for your quality issue report. This is an interesting one. Could you please clarify whether you are using a keyboard with a layout where the If not, do you still see the behaviour if you bind to |
And thanks for helping out with the support load, @mrlubos. |
@greena13 No problem Alex. I believe this is the same issue as attaching a handler on “2” and then pressing ⌘ + 2 to navigate away from a browser tab - the action gets called through submatch even though logically it seems it shouldn’t, right? |
I'm having a similar problem with sub matching. The problem is that a child have a handler for So when you are pressing I feel like is more correct that the event checks the parents handlers before starting on finding sub matches or that we have some options to disable sub matching. |
I think that's the problem I was having too. Sub-matches should be checked after all match handlers have been checked. |
I've encountered this issue as well. A handler for
|
@Chris-Slade yes, this is the approach I’d like to take! |
Thanks for all your feedback on how useful One of I believe it's the case that what you have requested (the longer key combinations and sequences take precedence) is indeed the case so long as they are defined at the same level (in the same component). That is, nesting takes precedence, and then combination/sequence length does. However, version 2.0 of My question to you all is, is the desired behaviour of key combinations' length taking precedence, irrespective or component nesting limited only to globally scoped keymaps? My hunch is yes. The current behaviour of |
@greena13 In my case I think the answer is yes. Currently I'm handling application-level shortcuts using a I'm wondering if it would be desirable/feasible to continue re-using the resolution algorithm for "regular" and global hotkeys, but to extend the key-map API to allow some form of configuration for which handlers are invoked in the case of there being overlapping shortcut definitions in a tree of const keyMap = {
SEARCH: '/',
HELP: { key: 'shift+/', overrideSubmatch: [ '/' ] },
}; |
Hey @FutureKode, I believe this should be fixed in v2.0.0-pre7. Please let me know if that's not the case. |
Describe the bug
Handler for
/
is getting called for?
How are you using react hotkeys components? (HotKeys, GlobalHotKeys, IgnoreKeys etc)
One GlobalHotKeys to handle
/
to focus a search inputAnother GlobalHotKeys to handle
?
to show a hotkeys help modal.Expected behavior
I would expect ? to not match /
Platform (please complete the following information):
Are you willing and able to create a PR request to fix this issue?
Possibly
APPLICABLE TO v2.0.0-pre1 AND ABOVE: ======================
Include the smallest log that includes your issue:
What Configuration options are you using?
None
The text was updated successfully, but these errors were encountered: