shentao/vue-global-events

Shift and Ctrl keyup events bug

nabebin opened this issue ยท 3 comments

Keyup events for shift and ctrl keys don't work as intended, other keys are ok though.
Example: https://jsfiddle.net/uem1wkaz/

posva commented

they do work ๐Ÿ˜…
You will have to provide more info about what isn't working, like steps to reproduce. Closing for the moment

posva commented

oooh, now I understand, you meant the keyup event not working! I was confused by the two event handlers keydown and keyup
Let me explain what is happening there, ctrl and shift are modifiers. Therefore the keyup.prevent.ctrl only triggers on a keyup while ctrl is being hold (same for shift).
This should be doable using a key code though. Let me put up the example

posva commented

For control, you will have to write this:

<global-events
  @keydown.prevent.17="plusOne"
  @keyup.prevent.17="minusOne"
/>

I added this to the readme