I am getting weird behavior where Javascript event that I am trying to dispatch is not being interpreted as event while when I inspect it is is Event
.
Then it fails with following error:
Uncaught InvalidStateError: Failed to execute 'dispatchEvent' on 'EventTarget': The event provided is null.
I must be missing something obvious here.
I just had this problem, and it was solved by cloning the event:
if (event && event.originalEvent) {
var oe = event.originalEvent;
this.dispatchEvent(new oe.constructor(oe.type, oe));
}