`event.clipboardData.getData()` does not reflect successful `setData()` call

Confirmed Issue #14110451 • Assigned to Grisha L.

Details

Author
Lucas G.
Created
Oct 6, 2017
Privacy
This issue is public.
Found in
  • Microsoft Edge
Found in build #
15.15063
Reports
Reported by 1 person

Sign in to watch or report this issue.

Steps to reproduce

Consider the following script:

<script>
  document.addEventListener("copy", function(e) {
    e.clipboardData.setData("text/plain", "plain text");
    console.log(e.clipboardData.getData("text/plain"));
    e.preventDefault();
  });
  function f() {
    document.execCommand("copy");
  }
</script>
<button onclick="f()">Button</button>

The setData() call succeeds, because the string “plain text” actually ends up on the clipboard. However, it is not possible to confirm this, because the getData() call returns an empty string.

Chrome, Safari, and Firefox correctly return the value that setData() sets on e.clipboardData:
https://github.com/lgarron/clipboard.js/blob/v2/test/Conclusions.md#test-results

Attachments

0 attachments

    Comments and activity

    • Microsoft Edge Team

      Changed Assigned To to “James M.”

      Changed Assigned To to “travil”

      Changed Assigned To from “travil” to “Travis L.”

      Changed Assigned To to “Grisha L.”

      Changed Status to “Confirmed”

    You need to sign in to your Microsoft account to add a comment.

    Sign in