🐛 Fix #201: Always allow submatches for combinations involving command #207
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context
When the
Cmd
(Meta
) key is pressed down with other keys, it hides theirkeyup
events, and only theMeta
keykeyup
event is triggered.react-hotkeys
accounts for this and simulates thekeyup
events for all the keysMeta
was pressed down with, when the itskeyup
event is detected.However, if you hold down
Meta
with another key, release the other key and press a third key whileMeta
is still down,react-hotkeys
does not know the first key has been released until you also releaseMeta
. So for example, if you pressMeta
down, thena
, then releasea
and pressb
-react-hotkeys
thinks you're still holdingMeta+a+b
until you releaseMeta
. This is undesirable, but (so far as I can come up with) unavoidable, and generally does not cause problems.When it does cause a problem is if you have actions for both
Meta+a
andMeta+b
: the second action is never triggered. This used to work through submatching:Meta+a+b
would still match an action bound toMeta+b
. However, v2.0.0-pre7 introduced a new configuration optionallowCombinationSubmatches
(which isfalse
by default) to address the multiple issues submatches were causing (#161, #181, #175), that disables this. And so we arrive at #201.This pull request
allowCombinationSubmatches
when Command is currently pressed