I'm currently trying to trigger a trusted textInput TextEvent from a Chrome extension.
In Chrome ≤ 52 I could do the following thing:
const textEvent = document.createEvent('TextEvent')
textEvent.initTextEvent('textInput',
true,
true,
null,
'myString');
document.activeElement.dispatchEvent(textEvent)
In Chrome 53, I had the following workaround:
document.execCommand('insertText', false, 'myString')
But it shouldn't have worked at all (design mode not enabled, and should only work for contenteditable
divs)
As expected, in Chrome 54 my workaround doesn't work anymore... Has anyone got an idea ?
It is related to this issue: As of Chrome 53, how to add text as if a trusted textInput event was dispatched?