You should use keydown
and not keypress
.
Keypress (deprecated) is usually used only for keys that produce a character output as per the docs
The keypress event is fired when a key is pressed down and that key normally produces a character value
The keydown event is fired when a key is pressed down.