New issue
Advanced search Search tips

Issue 752405 link

Starred by 2 users

Issue metadata

Status: Duplicate
Merged: issue 771604
Owner: ----
Closed: Aug 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug-Regression



Sign in to add a comment

SAP: Text selected by JS is not copied into clipboard with Chrome 60

Reported by thorsten...@sap.com, Aug 4 2017

Issue description

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

Steps to reproduce the problem:
1) open https://codepen.io/anon/pen/gxMZrK
2) click on the button “Button”: The text “Hello, World!” will be selected
3) press [CTRL][C] to copy the selected text to the clipboard

Issue: The text is not copied to the clipboard (check this by pasting it ([CTRL][V]) to a text editor or something else)

What is the expected behavior?
Text should be copied into clipboard

What went wrong?
With Chrome 59 the text was copied into clipboard but starting with Chrome 60 this doesn't work anymore. 

Did this work before? Yes 59

Chrome version: 60.0.3112.90  Channel: stable
OS Version: 10.0
Flash Version:
 

Comment 1 by kochi@chromium.org, Aug 7 2017

Components: -Blink Blink>Editing>Selection
Owner: yosin@chromium.org
Status: Untriaged (was: Unconfirmed)

Comment 2 by yosin@chromium.org, Aug 7 2017

Owner: ----
Status: WontFix (was: Untriaged)
Mark WontFix, since selection doesn't have focus.

In this sample, focus is in BUTTON by clicking BUTTON.
This behavior is introduces by the patch[1].

To workaround, change mySelect() function to set focus
to "mySpan" or use Selection#collapse(), which set focus, and expand()
instead of Selection#addRange() which doesn't set focus.


void Editor::Copy(EditorCommandSource source) {
  if (TryDHTMLCopy())
    return;  // DHTML did the whole operation
  if (!CanCopy())
    return;

  // TODO(editing-dev): The use of updateStyleAndLayoutIgnorePendingStylesheets
  // needs to be audited.  See http://crbug.com/590369 for more details.
  // |tryDHTMLCopy| dispatches copy event, which may make layout dirty, but
  // we need clean layout to obtain the selected content.
  GetFrame().GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets();

  if (source == kCommandFromMenuOrKeyBinding &&
      !GetFrame().Selection().SelectionHasFocus())
    return;


[1] http://crrev.com/2894473003 Fix behavior of clipboard commands when there is unfocused selection

Comment 3 by hu...@vewd.com, Dec 4 2017

Mergedinto: 771604
Status: Duplicate (was: WontFix)

Sign in to add a comment