dmauro / Keypress

A keyboard input capturing utility in which any key can be a modifier key.
http://dmauro.github.io/Keypress/
Apache License 2.0
3.18k stars 313 forks source link

Can't type character when it's used in combo #94

Closed jignesh88 closed 9 years ago

jignesh88 commented 9 years ago

when you use "ctrl + alt + n" as combo with PreventDefault = true, user can't type "n" in input field.

if I remove preventDefault = true then it's fine. I think Prevent Default should just prevent default action for control keys not for char keys.

https://jsfiddle.net/h655judn/

dmauro commented 9 years ago

This is the expected behavior. Most likely you'll get the behavior you want by not using prevent_default. From the documentation:

prevent_default: Any handlers for your combos will event.preventDefault() for the relevant event by default (you can return true in the handler to prevent this). But there is additionally a prevent_default property which will preventDefault() for events of keypresses of all constituent keys of the combo. What this means is that if you have a combo "shift s", both 'shift' and 's' keypresses will independently preventDefault() when pressed.