keydown
The keydown event is fired when a key is pressed down on the keyboard. It is part of the KeyboardEvent interface and can be listened for on window, document, or individual elements using addEventListener or the onkeydown handler. The event fires for all keys, including non‑printing keys such as Escape, Arrow keys, and function keys.
In the standard event sequence, keydown occurs before keypress (which is primarily for printable characters and
The event object carries several useful properties. key is the value of the key pressed, reflecting the
Keydown listeners are commonly used for keyboard shortcuts, game controls, or live input handling. They bubble