Issue metadata
Sign in to add a comment
|
It's impossible to trigger a trusted TextEvent textInput from an extension
Reported by
t.rebo...@gmail.com,
Oct 19 2016
|
||||||||||||||||||||||
Issue description
UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:49.0) Gecko/20100101 Firefox/49.0
Steps to reproduce the problem:
In the content script of an extension, execute the following code:
const textEvent = document.createEvent('TextEvent')
textEvent.initTextEvent('textInput',
true,
true,
null,
'myString');
document.activeElement.dispatchEvent(textEvent)
What is the expected behavior?
I expected that a Chrome extension could fire trusted events, and that the textInput TextEvent would trigger the default behaviour.
What went wrong?
Since Chrome 53, synthetic events do not trigger the default behaviour. I understand it is important for a regular website, but coming from the content script of an extension this is really blocking for me.
In Chrome 53 I had a workaround with document.execCommand('insertText', false, 'myString') that worked but shouldn't have. Not so suprisingly it doesn't work in Chrome 54.
Did this work before? Yes 52
Does this work in other browsers? N/A
Chrome version: <Copy from: 'about:version'> Channel: n/a
OS Version: OS X 10.11
Flash Version: Shockwave Flash 23.0 r0
,
Oct 20 2016
To further prove my point, insertText approach is also recommended by a chromium developer in issue 648232 .
,
Oct 20 2016
could you please provide the sample Html file to traige the issue further. Thanks.
,
Nov 4 2016
,
Nov 7 2016
Can you please provide the document where execCommand doesn't work? I've tried both on input fields and inside content editable text and it appears to work fine. Chrome 54.0.2840.71 on OSX 10.11.6
,
Nov 9 2016
t.rebours@ ping; we are waiting to see the example where execCommand doesn't work.
,
Nov 10 2016
We will keep this open until the 21st waiting for an example since we aren't able to reproduce it yet.
,
Nov 29 2016
Closing as per #7. No response provided; unable to reproduce. |
|||||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||||
Comment 1 by woxxom@gmail.com
, Oct 20 2016>In Chrome 53 I had a workaround with document.execCommand('insertText', false, 'myString') that worked but shouldn't have. Not so suprisingly it doesn't work in Chrome 54. Actually, it is surprising, and looks like a regression because Chrome allows insertText/insertHTML on input and textarea elements, see issue 558919 (personally I agree with the comment suggesting Firefox should change its behavior). FWIW, insertText workaround is functional here on Windows (tested in Chrome 53,54,56).