New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.
Starred by 54 users

Issue metadata

Status: Fixed
Merged: issue 602947
Owner: ----
Closed: Feb 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Feature


Show other hotlists

Hotlists containing this issue:
Top-Starred-Bugs


Sign in to add a comment
link

Issue 147490: Clipboard uses text that has user-select: none

Reported by marius.f...@gmail.com, Sep 9 2012

Issue description

Chrome Version       : 21.0.1180.89
OS Version: OS X 10.6.8
URLs (if applicable) :
Other browsers tested:
  Add OK or FAIL after other browsers where you have tested this issue:
     Safari 5:
  Firefox 4.x:
     IE 7/8/9:

What steps will reproduce the problem?
1. Take this html code:

Bug example<br/><div style="-webkit-user-select: none;">This should not be copied</div> <br/>Select all </div> Hi all

2. Select all and copy the content to your clipboard. 

What is the expected result?
Text in the div should not be highlighted. All content should be copied to the clipboard expect of text that is effected by "-webkit-user-select: none"


What happens instead?
Text in the div is not being highlighted.All content is copied to the clipboard. Even the text inside the "-webkit-user-select: none" div.


Please provide any additional information below. Attach a screenshot if
possible.

UserAgentString: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.89 Safari/537.1
 
test.html
124 bytes View Download

Comment 1 by meh...@chromium.org, Sep 9 2012

Labels: -Area-Undefined Area-WebKit Action-FeedbackNeeded
Can you reproduce this issue with Chrome Canary too ?

Download at: https://tools.google.com/dlpage/chromesxs

Comment 2 by marius.f...@gmail.com, Sep 9 2012

Yes that bug does even appear with the latest Canary build.

Comment 3 by meh...@chromium.org, Sep 9 2012

Okay. Thanks for your feedback. Could please do one more test for us:

Please check it with http://nightly.webkit.org/. If it is also a problem with Webkit Nightly, then please file also a report at https://bugs.webkit.org/ and post the webkit-bug-number here.

Many thanks in advance.

Comment 4 by manoranj...@chromium.org, Oct 18 2012

Cc: manoranj...@chromium.org
marius.falke@, Could you please update us as per comment#3?

Thanks,
Mano

Comment 5 Deleted

Comment 6 Deleted

Comment 7 by marius.f...@gmail.com, Jan 16 2013

Sorry for my late reply.

The latest Webkit build is effected by this bug too. There is also a webkit bug report available but nobody seems to care about it anymore https://bugs.webkit.org/show_bug.cgi?id=80159

One user writes that it does work properly on Firefox but on my system (Mac OS, Firefox 16.0.1) it does not.

Comment 8 by twkie....@gmail.com, Jan 16 2013

In firefox the text is selected, but doesn't show up in the clipboard. In chrome, the text isn't selected, but still ends up in the clipboard.

Comment 9 by romain.l...@gmail.com, Jan 22 2013

I confirm it still happens in last chrome stable version (24.0.1312.52)

Comment 10 by bugdroid1@chromium.org, Mar 9 2013

Project Member
Labels: -Action-FeedbackNeeded Needs-Feedback

Comment 11 by bugdroid1@chromium.org, Mar 10 2013

Project Member
Labels: -Area-WebKit Cr-Content

Comment 12 by bugdroid1@chromium.org, Apr 5 2013

Project Member
Labels: -Cr-Content Cr-Blink

Comment 13 by krinklem...@gmail.com, May 20 2013

Confirmed in Chrome 26 (stable) and Chrome 29 (canary).

Comment 14 by falken@chromium.org, Aug 20 2013

Labels: -OS-Mac -Needs-Feedback Cr-Blink-Editing
Status: Available
An even simpler test case:
abc<span style="-webkit-user-select: none">def</span>ghi

If you Select All and copy, only "abc" and "ghi" is shown selected, but "abcdefghi" is copied.

It seems there's no consensus on https://bugs.webkit.org/show_bug.cgi?id=80159 about the desired behavior. Not sure what we want to do either.

Comment 15 by falken@chromium.org, Aug 20 2013

Cc: yosin@chromium.org
+yosin: FYI

Comment 16 by falken@chromium.org, Aug 20 2013

Labels: -Cr-Blink
Also it's worth nothing that window.getSelection includes the "user-select: none" text.

Comment 17 by yosin@chromium.org, Aug 30 2013

Labels: -Type-Bug Type-Feature
Status: Unconfirmed
Summary: Feature Request: How do you copy contents with -webkit-user-select: none? (was: Chrome copies unselected text to the clipboard when -webkit-user-select: none; is activated)
The spec doesn't specified behavior yet.
Chrome, FireFox and IE do differently, see attached file; it is produced by http://jsfiddle.net/GdRme/

It seems Chrome's choice is confusing because visual and copied content are different.
cr147490.png
6.2 KB View Download

Comment 18 by yosin@chromium.org, Aug 15 2014

Labels: Cr-Blink-Selection

Comment 19 by yosin@chromium.org, Nov 14 2014

 Issue 425944  has been merged into this issue.

Comment 20 by laughing...@gmail.com, Jan 2 2015

FYI Firefox's confusing behavior where "the text is selected, but doesn't show up in the clipboard" has been fixed in Firefox 35 (currently still in beta): https://bugzilla.mozilla.org/show_bug.cgi?id=739396

So -moz-user-select:none is pretty much perfect now in Firefox.

Comment 21 by manoranj...@chromium.org, Jan 5 2015

Status: Untriaged
Marking 'untriaged' as this is a new feature request.

Thank you!

Comment 22 Deleted

Comment 23 by tkent@chromium.org, Jul 21 2015

Labels: -Cr-Blink-Selection Cr-Blink-Editing-Selection

Comment 24 by yosin@chromium.org, Jul 23 2015

Owner: yoichio@chromium.org
Status: Assigned

Comment 25 by tkent@chromium.org, Aug 5 2015

Labels: -Cr-Blink-Editing-Selection Cr-Blink-TextSelection

Comment 26 by yosin@chromium.org, Aug 20 2015

Cc: aelias@chromium.org jdduke@chromium.org donnd@chromium.org
 Issue 425800  has been merged into this issue.

Comment 27 by yosin@chromium.org, Aug 20 2015

 Issue 521337  has been merged into this issue.

Comment 28 by yoichio@chromium.org, May 20 2016

Mergedinto: 602947
Status: Duplicate (was: Assigned)

Comment 29 by yoichio@chromium.org, May 23 2016

Cc: yoichio@chromium.org
 Issue 602947  has been merged into this issue.

Comment 30 by yoichio@chromium.org, May 23 2016

Status: Available (was: Duplicate)
Summary: Dragging over user-select:none should not be select the element. (was: Feature Request: How do you copy contents with -webkit-user-select: none?)
Pasted from  Issue602947 
Version: Version 52.0.2706.0 canary (64-bit)
OS: Windows

What steps will reproduce the problem?
(1) go http://output.jsbin.com/sidaquzumo
(2) drag over a user-select:none element.
(3) copy and paste to textarea

What is the expected output?
The user-select:none element should not be selection-painted and not be copied.

What do you see instead?
The element was copied.

Interoperability
FireFox: The element is not selection-painted and is not copied.
Edge: The element is selection-painted and is copied.

Comment 31 by phistuck@chromium.org, May 23 2016

Labels: Hotlist-Interop
Marking as an interoperability issue, like the issue that was just merged into it.

Comment 32 by yoichio@chromium.org, Jul 7 2016

Owner: xiaoche...@chromium.org

Comment 33 by pgrevi...@gmail.com, Aug 10 2016

To extend on this, user-select:none elements could benefit from an optimization by not repainting them as the selection passes over them, and when a selection containing a user-select:none element is removed.

Try visiting https://jsfiddle.net/Kredit/f1oujqpr/ , enabling Paint Flashing in extra rendering settings in Chrome DevTools, and highlighting from "ipsum" to "Sed".  Notice how everything between is repainted.  Now deselect by clicking somewhere else, and notice how the user-select-none element is repainted again.

Comment 34 by nicopr...@gmail.com, Aug 31 2016

There are actually cases where -webkit-user-select: none CAUSES the text to be copied where it would not before!

On Chrome 52.0.2743.116 (64-bit) for OS X, with the following HTML:

<div>
  <div>Some text above the no copy</div>
  <div class="nocopy">NOCOPY</div>
  <div>
    Some more text down here
  </div>
</div>

If the .nocopy class has -webkit-user-select: none, and I triple click inside of the top div to select the line and copy, the clipboard has:

Some text above the no copy
NOCOPY

If I do the same thing without -webkit-user-select: none, then the clipboard has "Some text above the no copy" as expected.

Here's a jsfiddle: https://jsfiddle.net/q4pLyL6u/

Comment 35 by aelias@chromium.org, Aug 31 2016

Cc: -aelias@chromium.org -donnd@chromium.org

Comment 36 by yosin@chromium.org, Oct 5 2016

Cc: -yoichio@chromium.org -yosin@chromium.org
Owner: yoichio@chromium.org
Status: Assigned (was: Available)

Comment 37 by tkent@chromium.org, Oct 12 2016

Components: -Blink>TextSelection Blink>Editing>Selection

Comment 38 by yoichio@chromium.org, Nov 7 2016

Cc: yoichio@chromium.org
 Issue 662783  has been merged into this issue.

Comment 39 by hu...@opera.com, Jul 18 2017

Status: Fixed (was: Assigned)
This works for me in 60.0.3112.66.

Comment 40 by hu...@opera.com, Jul 20 2017

Status: Available (was: Fixed)
Selection with drag (or CTRL+A) no longer highlights 'user-select: none' but marked text can still be copied.

Comment 41 by hu...@opera.com, Jul 20 2017

Summary: Clipboard uses text that has user-select: none (was: Dragging over user-select:none should not be select the element.)

Comment 42 by hu...@opera.com, Jul 20 2017

Cc: hu...@opera.com
 Issue 705526  has been merged into this issue.

Comment 43 by yosin@chromium.org, Oct 4 2017

Labels: Pri-3

Comment 44 by reynolds...@gmail.com, Oct 25 2017

I can confirm that this issue still exists.

Mac OS Sierra: Version 10.12.6
Chrome: Version 61.0.3163.100 (Official Build) (64-bit)

Comment 45 by pssgc...@gmail.com, Oct 26 2017

Also can confirm.

Debian GNU/Linux Buster, Linux 4.13.4-2
Chrome: 63.0.3239.9 (Official Build) dev (64-bit)

Comment 46 by hu...@vewd.com, Oct 30 2017

Labels: -Pri-3 Pri-2

Comment 47 by yosin@chromium.org, Oct 31 2017

Owner: ----

Comment 48 by bugdroid1@chromium.org, Nov 15 2017

Project Member
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/b459f745e00bbe6734a144bcd29eefb3cd676a39

commit b459f745e00bbe6734a144bcd29eefb3cd676a39
Author: tanvir.rizvi <tanvir.rizvi@samsung.com>
Date: Wed Nov 15 06:23:08 2017

Clipboard should respect user-select style attribute

Clipboard 'copy/paste'data also contains the elements on which
user-select:none property has been applied.
But the visible selection do not highlights those portions.
The copy data should respect the user-select attribute.
Currently the clipboard copy paste data only depends upon
the selection done in the DOM tree.
This CL makes the clipbaord text to work with the
text property

Bug:  147490 
Change-Id: I5ccc6ebce67e630d0eb9949e514da77f52a6ed42
Reviewed-on: https://chromium-review.googlesource.com/763032
Reviewed-by: Xiaocheng Hu <xiaochengh@chromium.org>
Reviewed-by: Yoshifumi Inoue <yosin@chromium.org>
Commit-Queue: Tanvir Rizvi <tanvir.rizvi@samsung.com>
Cr-Commit-Position: refs/heads/master@{#516608}
[add] https://crrev.com/b459f745e00bbe6734a144bcd29eefb3cd676a39/third_party/WebKit/LayoutTests/editing/selection/user-select-none-effect-clipboard-data.html
[modify] https://crrev.com/b459f745e00bbe6734a144bcd29eefb3cd676a39/third_party/WebKit/Source/core/editing/FrameSelection.cpp
[modify] https://crrev.com/b459f745e00bbe6734a144bcd29eefb3cd676a39/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp
[modify] https://crrev.com/b459f745e00bbe6734a144bcd29eefb3cd676a39/third_party/WebKit/Source/core/editing/iterators/TextIterator.h
[modify] https://crrev.com/b459f745e00bbe6734a144bcd29eefb3cd676a39/third_party/WebKit/Source/core/editing/iterators/TextIteratorBehavior.cpp
[modify] https://crrev.com/b459f745e00bbe6734a144bcd29eefb3cd676a39/third_party/WebKit/Source/core/editing/iterators/TextIteratorBehavior.h

Comment 49 by yosin@chromium.org, Jan 10 2018

Labels: Pri-3

Comment 50 by michaels...@gmail.com, Feb 1 2018

Seems to work fine now in Chrome 64.0.3282.119 on Windows 8.1

Comment 51 by pssgc...@gmail.com, Feb 1 2018

I can also confirm that it is working now.

Debian GNU/Linux Buster, Linux 4.14.13-1
Chrome: 65.0.3325.31 (Official Build) dev (64-bit)

Comment 52 by yoichio@chromium.org, Feb 2 2018

Status: Fixed (was: Available)

Comment 53 by chris.mo...@gmail.com, Jun 7 2018

This is NOT fixed completely.

If you paste text/plain (e.g. into a <textarea>), the `user-select: none` content is correctly excluded.

But if you paste text/html (e.g. into a <div contenteditable>), the `user-select: none` content is included.

(Reproduced on Chrome 67 on Windows.)

Comment 54 by labobol...@gmail.com, Jun 7 2018

Whatever the devs have done to fix this, they failed and did it incorrectly.

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.

Tested with Chrome Version 67.0.3396.62.
repo_bug_clipboard_sloppy_fix.zip
1.7 KB Download

Comment 55 by jdduke@chromium.org, Jun 7 2018

Cc: -jdduke@chromium.org

Comment 56 by phistuck@gmail.com, Jun 7 2018

#53, 54 - you might want to file new issues for those, as 5 versions have already been branched since the fix (#48). You can comment here with the new issues.

Comment 57 by labobol...@gmail.com, Jun 7 2018

#56 - New issue created on your suggestion.
Issue 850685 - "Text selection includes text from elements with user-select: none" - https://bugs.chromium.org/p/chromium/issues/detail?id=850685

The new issue may require tags adjustments that I am unable to do.

Sign in to add a comment