Fork me on GitHub
#reagent
<
2023-02-14
>
joshcho18:02:58

I am trying to dispatch a keypress event that is detected by an element. But when I do the following:

(.dispatchEvent (.. js/document -activeElement)
                (new js/KeyboardEvent "keypress" #js {:key "a"}))
The keyboard event is not detected by :on-key-press or :on-key-down of the element, but it works with event listeners. How would I make this work with :on-key-down and :on-key-press properties?

p-himik19:02:21

And the whole post has a bit of "how to fix".