New issue
Advanced search Search tips

Issue 850685 link

Starred by 2 users

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug

Blocked on:
issue 851279



Sign in to add a comment

Text selection includes text from elements with user-select: none

Reported by labobol...@gmail.com, Jun 7 2018

Issue description

UserAgent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.79 Safari/537.36

Example URL:
https://www.youtube.com/watch?v=Vd2FTtu0sVE&lc=Ugz6a441HgR5IrRZHMJ4AaABAg.8hAo7DI0OQ08hBpag9d8Vm

Steps to reproduce the problem:
I have created a repo showing two ways to get the text selection.
First one via window.getSelection (using chrome.commands and content script).
Note: You will have to set the keyboard shortcut command in chrome://extensions/shortcuts
I used Ctrl+Shift+S.

Second one via clickData.selectionText (using chrome.contextMenus).

Test site: https://www.youtube.com/watch?v=Vd2FTtu0sVE&lc=Ugz6a441HgR5IrRZHMJ4AaABAg
Scroll down to "Highlighted comment" and click "View all <number> replies".
Find a comment with the "Read more". Select the whole comment via double click on comment text or via manual mouse selection, drag mouse until see the Thumbs up vote number getting selected.
Note: For the "Read more" to show up you will have to be logged in. Discovered that out when I tested in incognito mode.
I used the second comment from TheHektor89. https://www.youtube.com/watch?v=Vd2FTtu0sVE&lc=Ugz6a441HgR5IrRZHMJ4AaABAg.8hAo7DI0OQ08hBpag9d8Vm

The text selection output is shown in the background page -> console tab.
It demonstrates that the text selection incorrectly includes "Read more".

Tested with Chrome Version 67.0.3396.79.

What is the expected behavior?
"user-select: none" should be respected.

What went wrong?
"user-select: none" is ignored.

Does it occur on multiple sites: Yes

Is it a problem with a plugin? No 

Did this work before? No 

Does this work in other browsers? Yes

Chrome version: 67.0.3396.79  Channel: stable
OS Version: 6.1 (Windows 7, Windows Server 2008 R2)
Flash Version: 

I am creating this issue on the suggestion of phistuck@gmail.com - https://bugs.chromium.org/p/chromium/issues/detail?id=147490#c56

I am also referencing that issue as it is related:  Issue 147490  - "Clipboard uses text that has user-select: none" - https://bugs.chromium.org/p/chromium/issues/detail?id=147490
 
repo_bug_clipboard_sloppy_fix.zip
1.7 KB Download
Components: -Blink Blink>Editing>Selection
Labels: Hotlist-Interop
Labels: Needs-Triage-M67

Comment 4 by hu...@vewd.com, Jun 12 2018

Blockedon: 851279
Cc: yoichio@chromium.org hu...@vewd.com
Labels: -Arch-x86_64 -Needs-Triage-M67 Arch-All
Status: Available (was: Unconfirmed)
I guess CTRL+C excludes |user-select: none| because SelectedTextForClipboard() sets SetSkipsUnselectableContent(true). 

Perhaps it's enough to let getSelection().toString() use SetSkipsUnselectableContent(true) too?

I can imagine Chrome will use multi-range selections (Issue 851279) to handle |user-select: none| in the future. But that shouldn't change toString()? I'd expect toString() to always return the very same string: text of [concatenated] range[s] without |user-select: none|? WDYT?

Sign in to add a comment