Capture global arrow key up


Is there any way to capture the arrow key up gobally, no matter what’s the focus element?


Yes, assign listener to the window.

And what’s the way to do that? :slight_smile:

Here is the documentation given by the MDN.

Thanks, I have seen that I can capture the keydown like this:

window.addEventListener('keydown', function(e) {

Now the problem is: how I can send the keydown to Vue? I want to run a method of a component on the keydown event.

Maybe something like this:


I wanted to do the same and created a component for it that easily implements this functionality wherever you need it:

npm i vue-keypress

Hope it helps :slight_smile: