reagent

joshcho 2023-02-14T18:28:58.956549Z

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-himik 2023-02-14T19:33:13.658449Z

A short explanation on "why": https://stackoverflow.com/a/39066491/564509

p-himik 2023-02-14T19:33:21.791329Z

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