Open Bug 1327461 Opened 7 years ago Updated 1 year ago

Youtube - \n linebreaks and whitespaces aren't copied to clipbord when I copy comments


(Core :: DOM: Editor, defect, P3)





(Reporter: arni2033, Unassigned)


(Keywords: parity-chrome)


(1 file)

>>>   My Info:   Win7_64, Nightly 49, 32bit, ID 20160526082509
1. Open
2. Expand the first comment (opened by link)
3. Select all text in that commend using mouse
4. Press Ctrl+C to copy text
5. Open scratchpad (Shift+F4), press Ctrl+V to paste text

1. Open url [1]
2. Select all text with mouse or press Ctrl+A
3. Press Ctrl+C to copy text
4. Click in textarea, press Ctrl+V to paste text

AR:  No linebreaks. Multiple whitespaces replaced to one whitespace
ER:  Linebreaks should be copied correctly

> [1] data:text/html,<div style="white-space: pre-wrap;">Known Firefox regressions since Firefox 28:%0A1.   Searchbar's broken%0A2.   Location bar's broken%0A3.   Bookmarks panel's broken%0A4.   Core is heavily damaged%0A5.   e10s is incredibly laggy%0A%0ACan hardly use this browser now</div><textarea style="height:200px; width:600px;">
No longer blocks: 1277113
Product: Firefox → Core
User Agent:  Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:53.0) Gecko/20100101 Firefox/53.0

I have tested this issue on Windows 10 x64 with the latest Firefox release (50.1.0) and the latest Nightly (53.0a1-20170104030214) and managed to reproduce it following the steps in STR_1.
Component: Untriaged → Developer Tools: Scratchpad
Product: Core → Firefox
Moving back to Core/Untriaged

Scratchpad is only used as a random editor here, STRs can be reproduced regardless of the usage of Scratchpad.
Issue lies with the copy/paste of linebreaks.
Component: Developer Tools: Scratchpad → Untriaged
Product: Firefox → Core
I will assign the Core:Editor component and perhaps there's someone with extensive knowledge on this area that might be able to help here.
Component: Untriaged → Editor
Priority: -- → P3
Mass bug change to replace various 'parity' whiteboard flags with the new canonical keywords. (See bug 1443764 comment 13.)
Keywords: parity-chrome
Whiteboard: [parity-Chrome]
I can narrow down the problem quite a bit for you.

YouTube is sticking some `\n`-delimited text in a custom element and styling it with `white-space: pre-wrap;` and Firefox has a bug in how it copies `white-space: pre-wrap;` text to the clipboard.

Specifically, Firefox only takes the effect of `white-space: pre-wrap;` into account when populating the clipboard if the selection begins and/or ends outside of the element thus styled. If your selection is contained entirely within it, then you lose your linebreaks.

Here's a minimal example with built-in instructions that I've confirmed to reproduce the problem on a freshly-updated Nightly with a brand new profile.
While I was blogging about this to raise the visibility of the workaround, I realized that this isn't the only symptom which may be due to the same root cause.

I've filed bug 1489943 to address the other situation I've found where copying to the clipboard behaves in a buggy and counterintuitive fashion conditional on whether the selection crosses a DOM node boundary.
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.