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

Issue 756444 link

Starred by 2 users

Issue metadata

Status: WontFix
Owner: ----
Closed: Aug 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug-Regression



Sign in to add a comment

"beforecopy" event doesn't triggered on no-text DOM elements

Reported by p_bal...@setka.io, Aug 17 2017

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36

Steps to reproduce the problem:
1. Create no-text DOM element (for example DIV)
2. Add possibility to DOM focus to this element with adding attribute tabindex="-1"
3. Add event listener to "beforecopy" event
4. Add this element in focus
5. Try to copy it (via cmd+C)

What is the expected behavior?
"beforecopy" event should be triggered

What went wrong?
"beforecopy" event doesn't triggered

Did this work before? Yes 59

Chrome version: 60.0.3112.90  Channel: n/a
OS Version: OS X 10.12.2
Flash Version: 

"beforecopy" event triggered in v.59 and older versions of Chrom as well. But after updated my browser to v.60 this event works on text-elements only.
 

Comment 1 by tkent@chromium.org, Aug 17 2017

Components: -Blink Blink>Editing
Labels: Needs-Bisect

Comment 2 by hdodda@chromium.org, Aug 18 2017

Cc: hdodda@chromium.org
Labels: Needs-Triage-M60 Needs-Feedback
@p_baluev-- Thanks for reporting the issue . Could you please provide us a sample test file/jsfiddle to reproduce the issue , along with the expected and actual result screenshots , which would help us in better understnding.

Thanks!

Comment 3 by yosin@chromium.org, Aug 21 2017

Components: -Blink>Editing Blink>Editing>Paste
Summary: NEEDS_FEEDBACK "beforecopy" event doesn't triggered on no-text DOM elements (was: "beforecopy" event doesn't triggered on no-text DOM elements)
Per #c2, please provide sample HTML to reproduce this.
Thanks!

Note: It seems #c1 steps to try to copy collapsed selection, to copy something into 
clipboard, selection should be range selection.

Comment 4 by p_bal...@setka.io, Aug 22 2017

I created source of problem prototype ( https://jsfiddle.net/1efhv3sm/ ).
There are contenteditable paragraph and figure element with nested div, img and figcaption inside. So you can click on each element and see in red-bordered area what element is focus right now. Alike this I log tagName of element on which the "beforecopy" event is called.


IN CHROME V.60.0.3112.90

So. At first I clicked on paragraph and try to copy it (via cmd+C)
Result log:
> focused on P
> "beforecopy" on P
As expected.

Then I try to click and copy figure and each nested element (div, img)
Result log:
> focused on FIGURE
> "beforecopy" on IMG
> focused on DIV
> "beforecopy" on IMG  
> focused on IMG
[And right here I expected "beforecopy" call on IMG, but this is not]


IN CHROME V.60.0.3112.101

The result of this procedure with paragraph is exactly the same as in Chrome v.60.0.3112.90.

Then I try to click and copy figure and each nested element (div, img)
Result log:
> focused on FIGURE
> "beforecopy" on IMG
> focused on DIV
> "beforecopy" on IMG  
> focused on IMG
> "beforecopy" on IMG [ this is absent in v.60.0.3112.90 ]

So you can see strange behavior: while IMG element stay in focus and I trying to copy it "beforecopy" event doesn’t triggered in Chrome v.60.0.3112.90.


Also I noticed another strange moment (in v.60.0.3112.101). If I try to reproduce procedure:

1. click on paragraph
2. click on img
3. copy img (cmd + C)
Result log will be:
> focused on P
> focused on IMG
> "beforecopy" on P [And I expected not P but IMG]

Project Member

Comment 5 by sheriffbot@chromium.org, Aug 22 2017

Labels: -Needs-Feedback
Thank you for providing more feedback. Adding requester "hdodda@chromium.org" to the cc list and removing "Needs-Feedback" label.

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

Comment 6 by yosin@chromium.org, Aug 23 2017

Status: WontFix (was: Unconfirmed)
Summary: "beforecopy" event doesn't triggered on no-text DOM elements (was: NEEDS_FEEDBACK "beforecopy" event doesn't triggered on no-text DOM elements)
Mark WontFix since it works as expected.

"beforecopy" event is dispatched to a node at selection start or BODY if selection
is none.

Note: "beforecopy" isn't standard event.

Sign in to add a comment