Matching non-modified key also picks up the same modified key
See original GitHub issueFor example if I’m looking for 'shift+left'
and 'left'
, looking for 'left'
will also pick up 'shift+left'
.
Here is a test case that will fail illustrating the problem:
it('matches only modified hotkey a', () => {
const check = isHotkey(['shift+a'])
const a = check(e(65, 'shift'))
const shifta = check(e(65, 'shift'))
assert.equal(a, false)
assert.equal(shifta, true)
})
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Modifier Keys - the Tcler's Wiki!
The "Windows" Modifier key takes the role of the Command/Apple/⌘ key. The Left-Alt and Right-Alt keys perform the same role, as on a...
Read more >Authorize with Shared Key (REST API) - Azure Storage
Learn how to authorize a request to Azure Storage with Shared Key.
Read more >How Match Keys Are Generated and Used in Matching Rules
Match keys help to increase the performance of duplicate rules through a preliminary comparison that narrows the matches to the 100 most likely...
Read more >CopyObject - Amazon Simple Storage Service
Creates a copy of an object that is already stored in Amazon S3. ... You can store individual objects of up to 5...
Read more >A Deep Dive on End-to-End Encryption: How Do Public ...
If you encode a message using a person's public key, they can decode it using their matching private key. Julia and César are...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Fixed in
0.1.4
, thank you both!Ugh sorry for all the churn, after stepping through a few times on both sides, it looks like
byKey
is getting used implicitly byisKeyHotkey
which is what slate is using. Here is an actual test case that fails with the shift null check you initially suggested:The problem is that because
shiftKey
is getting set tonull
it is just ignored when checking equality of the event: https://github.com/ianstormtaylor/is-hotkey/blob/master/src/index.js#L171It looks like setting shift to null should only happen
onKeyUp
? Or maybe the check should just be removed all together?