New issue
Advanced search Search tips

Issue 754593 link

Starred by 2 users

Issue metadata

Status: Untriaged
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 3
Type: Bug



Sign in to add a comment

clipboard events have wrong event target according to HTML5 spec

Reported by robertbcolton@gmail.com, Aug 11 2017

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:54.0) Gecko/20100101 Firefox/54.0

Steps to reproduce the problem:
1. Create an element, even just a div, with user-select: none;
2. Attach a cut or copy listener.
3. Attempt to receive cut or copy events on the element.

JSFiddle: https://jsfiddle.net/DerekL/c1n4vv7j/12/

What is the expected behavior?
Even though text selection is disabled, the element should still receive clipboard events.

What went wrong?
The element does not receive the clipboard events.

Did this work before? N/A 

Does this work in other browsers? Yes

Chrome version: 61.0.3163.39 (Official Build) beta (64-bit) (cohort: Beta)  Channel: n/a
OS Version: 10.0
Flash Version: Shockwave Flash 24.0 r0

Follows from StackOverflow post:
https://stackoverflow.com/questions/45627286/disable-text-selection-but-allow-cut-copy-and-paste

Chrome is not following the HTML5 Clipboard API spec because the <ul> should be receiving the clipboard events. It is the focused element which is what the spec states should be the event target, and we know it's focused because of its blue outline from tabindex="0"
 
Cc: pbomm...@chromium.org yosin@chromium.org
Components: Blink>Editing
Labels: M-61
Status: Available (was: Unconfirmed)

Comment 2 Deleted

I've also discovered other people creating React and Vue components where this bug basically breaks cut, copy, and paste for draggable elements:
https://github.com/mzabriskie/react-draggable/issues/219

I've also discovered if you change the cut handler to show us the activeElement, it reports the div and not the body:
$("*").on("cut", function(event){
  console.log(event.target);
  console.log(document.activeElement);
});
It also seems like someone previously was told they could submit a patch for this, but never ended up sending it?
https://groups.google.com/a/chromium.org/forum/#!msg/chromium-discuss/vIlnqmYU5d0/1_-TRQ8bCQAJ
I've also discovered that because of this bug, the HTML5 drag and drop prevents cut, copy, and paste because the draggable="true" automatically adds user-select: none; to the element in Chrome.
I've requested clarification from the W3C editing task force:
https://github.com/w3c/clipboard-apis/issues/47

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

Labels: Pri-3
Project Member

Comment 8 by sheriffbot@chromium.org, Jan 10

Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue.

Sorry for the inconvenience if the bug really should have been left as Available.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot

Sign in to add a comment