This is my code:
Mousetrap.bind('l', (e) => {
console.log('l')
})
Mousetrap.bind('k+l', (e) => {
console.log('k+l')
})
I have 2 questions:
1. When I press l I'm seeing both logs. Any ideas why?
2. When I'm pressing k + l, I'm seeing both logs too (I understand why) but any ideas how to prevent this?
Thanks
That's because
kis not a valid modifier key.As described in the docs:
In other words,
k+lis normalized tol, i.e. you are bindingltwice.For more details, you can check out the relevant bit of logic in the mousetrap source directly.