Why is this going to happen? - strange keydown keydown events on my machine

Here are some javascript:

window.addEventListener("keydown", function(event) {
        console.log("keydown: " + event.keyCode);
    });
window.addEventListener("keyup", function(event) {
        console.log("keyup: " + event.keyCode);
    });

Here is the result of my pressing and releasing the key only once:

keyup: 17
keydown: 68
keyup: 17
keyup: 68

This applies to my car. Why is this happening?

Note. I discovered this oddity in a flash where KeyboardEvents worked the same way.

+4
source share
1 answer

according to: http://www.cambiaresearch.com/articles/15/javascript-char-codes-key-codes

  • keycode 17 = ctrl
  • keycode 68 = d

, CTRL d. , , , .


:

addEventHandler , useCapture, . , . .

0

Source: https://habr.com/ru/post/1598105/


All Articles