Allow async call to document.execCommand('copy') from handler of user-initiated event

Confirmed Issue #7728456 • Assigned to Grisha L.

Details

Author
Hans M.
Created
May 29, 2016
Privacy
This issue is public.
Found in
  • Microsoft Edge
  • Firefox
Reports
Reported by 1 person

Sign in to watch or report this issue.

Steps to reproduce

  1. Navigate to http://hansifer.com/clipboardCopyTest.html
  2. Click on “Copy Async”
    • Note that execCommand(‘copy’) is reported to return false
  3. Paste contents of clipboard into textbox
    • Note that paste is reported as not matching copy attempt

The above page tests whether execCommand(‘copy’) can be successfully called outside of the call stack (eg, via setTimeout()) of the handler of a user-initiated event such as a click. Chrome allows this within a 1 second interval.

This capability is important to support use cases such as:

  1. Copy to clipboard from within handlers of extension browser_action clicks, page_action clicks, context menu clicks, and keyboard shortcut commands

  2. Using setTimeout() to rate-limit clicks or detect double/triple click

  3. Using an extension API, many of which are async, as the source of text to copy

    • Eg, browser.tabs.query()

The following browsers currently support this:

  • Chrome (1 sec delay)
  • Opera (1 sec delay)
  • IE11 (with user prompt; unlimited delay)
  • Safari Desktop Technology Preview

Attachments

0 attachments

    Comments and activity

    • Microsoft Edge Team

      Changed Assigned To to “Ibrahim O.”

      Changed Assigned To to “Travis L.”

      Changed Assigned To to “Amit J.”

      Changed Status to “Confirmed”

      Changed Assigned To to “Amit J.”

      Changed Assigned To from “Amit J.” to “Grisha L.”

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

    Sign in