I know it sounds quite trivial, but I’m having quite the trouble getting it to work. The only way to do it (that I’ve seen) would be to add a handler on the window
or document
objects, like:
window.addEventListener("keydown", { e: Event -> console.log(e) })
However, the Event
object obtained is the most basic event object there is. Most importantly, it doesn’t have a key
or code
property. There is a type of event handler specifically made for key presses (KeyboardEventHandler<Element>
), but I can’t add it on the window
or document
, as it’s not a React component. Would anyone know anything about this?
submitted by /u/Poqazz
[link] [comments]