-
Notifications
You must be signed in to change notification settings - Fork 81
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
Shortcut conflicts #37
Comments
Hm, yeah this is an unfortunate side effect of not breaking out of the matching when a match is found. There are a couple ways that this could be fixed:
// when typing "g" then "a"
tinykeys({
"g a": () => console.log("matches"),
"a": () => console.log("doesnt match"),
})
// and inversely
// when typing "g" then "a"
tinykeys({
"a": () => console.log("matches"),
"g a": () => console.log("doesnt match"),
})
// when typing "g" then "a"
tinykeys({
"a": () => console.log("doesnt match"),
"g": {
"a": () => console.log("matches"),
},
}) Right now I'm leaning more towards the second option... thoughts? |
Other downside of Option 2 is that you can't have just a // when typing "g" then "a"
tinykeys({
"a": () => console.log("doesnt match"),
"g": () => console.log("doesnt match"), // technically this just gets overwritten and forgotten
"g": {
"a": () => console.log("matches"),
},
}) |
Maybe it could just be: // when typing "g" then "a"
tinykeys({
"a": () => console.log("doesnt match"),
"g": {
"": () => console.log("matches"),
"a": () => console.log("matches"),
},
}) |
Yeah I think that Option 2 is the most preferred. We've been working around this by ordering them correctly and ignoring events that have already been handled (because in the case below the default is that both handlers run). Our code looks something like:
|
If I have a shortcut that is
g a
(go to all mail) anda
(archive) then they are both fired when I pressg a
I would expect onlyg a
to fire in this case.The text was updated successfully, but these errors were encountered: