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?A short explanation on "why": https://stackoverflow.com/a/39066491/564509
And the whole post has a bit of "how to fix".