Closed
Bug 1466391
Opened 8 years ago
Closed 8 years ago
Cannot Paste Text in YouTube Comment Box
Categories
(Web Compatibility :: Site Reports, defect, P1)
Tracking
(Not tracked)
VERIFIED
FIXED
People
(Reporter: dalef, Unassigned)
References
Details
(Whiteboard: [platform-rel-youtube][needsdiagnosis])
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:60.0) Gecko/20100101 Firefox/60.0
Build ID: 20180516032328
Steps to reproduce:
1. Select text from Firefox or any other application.
2. Right-click on selected text and left-click on Copy or press Control-C to copy text.
3. Open any YouTube video and click in the "Add a public comment..." box or reply to any pre-existing comment.
4. Attempt to paste text in comment box by right-clicking on comment box and left-clicking Paste or pressing Control-V to paste text.
Actual results:
The text was NOT pasted into the YouTube comment box. There were no observable changes when attempting to paste text; nothing happened.
Expected results:
The text stored in the Windows 10 clipboard should have been pasted in the YouTube comment box.
I have not encountered this problem with other Web sites.
Updated•8 years ago
|
Component: Untriaged → Desktop
Product: Firefox → Tech Evangelism
See Also: → 1197775,
https://webcompat.com/issues/1655
Version: 60 Branch → Firefox 60
Updated•8 years ago
|
Priority: -- → P1
Updated•8 years ago
|
Whiteboard: [platform-rel-youtube][needsdiagnosis]
Updated•8 years ago
|
Flags: needinfo?(oana.arbuzov)
Comment 5•8 years ago
|
||
Tom, can you dig into this please?
Flags: needinfo?(oana.arbuzov) → needinfo?(twisniewski)
Comment 7•8 years ago
|
||
Sent a message to Youtube on our partner mailing list.
Updated•8 years ago
|
Flags: needinfo?(twisniewski)
Comment 8•8 years ago
|
||
They've found the issue and have created a fix for it. Waiting to hear when it will be released.
They were affected by https://bugzilla.mozilla.org/show_bug.cgi?id=1220696#c15 when trying to use document.execCommand('insertText' on textarea/input) and provided a test case https://codepen.io/cheng-lee/pen/rKzbPx
Yes. I have same issue.
Here code from YouTube (desktop_polymer.js):
document.addEventListener('paste', this.onPaste_)
[...]
onPaste_: function (a) {
w2(a.target) && (a.preventDefault(), a = a.clipboardData.getData('text/plain'), document.execCommand('insertText', !1, a))
},
Here my test:
function handler(a){
a.preventDefault();
var b = a.clipboardData.getData('text/plain');
var c = document.execCommand('insertText', !1, b);
console.log(c, document.designMode);
a.stopPropagation();
}
addEventListener('paste', handler, true);
On FF 60.0.2 it not paste and show in console: false off
On Chrome 67.0.3396.87 it paste and show in console: true "off"
According MDN https://developer.mozilla.org/ru/docs/Web/API/Document/execCommand
execCommand must not work if document.designMode == 'off' but it is work on Chrome and this behavior used in YouTube code.
Possible two solution:
1. Fix code on YouTube
2. Fix FF behavior.
For Youtube, code must check return result from execCommand and do not preventDefault if it fail.
For example instead
onPaste_: function (a) {
w2(a.target) && (a.preventDefault(), a = a.clipboardData.getData('text/plain'), document.execCommand('insertText', !1, a))
},
use
onPaste_: function (a) {
w2(a.target) && (b = a.clipboardData.getData('text/plain'), document.execCommand('insertText', !1, b) && a.preventDefault())
},
Comment 11•8 years ago
|
||
Just to follow up on the bug 1220696 dependency, execCommand is not specified for form controls (e.g. textarea/input) only contenteditable. Discussion is going on in [1] to specify this but Youtube should not be relying on this behavior.
[1] https://github.com/w3c/editing/issues/160
Comment 12•8 years ago
|
||
This has been fixed by Google. Tested using Firefox 62 for MacOS.
Thanks everyone!
Status: UNCONFIRMED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Comment 13•8 years ago
|
||
Now fixed. Confirm for FF 60.0.2 32-bit on Windows.
Updated•8 years ago
|
Status: RESOLVED → VERIFIED
| Assignee | ||
Updated•7 years ago
|
Product: Tech Evangelism → Web Compatibility
You need to log in
before you can comment on or make changes to this bug.
Description
•