Re: [w3c/clipboard-apis] When called without gesture, return an error describing rejection (#66)

Aha! I assumed it was gesture since it was fixed when I moved the call to a
body onclick handler - but the active tab thing makes sense.

I agree with your suggestion though, having some kind of errors for these
cases would be very helpful.

At minimum maybe Chrome could show a console warning if we don’t want to
bake anything UA specific into the spec?
On Wed, Feb 14, 2018 at 2:51 PM Gary Kacmarcik <notifications@github.com>
wrote:

> The Async API doesn't require a gesture in Chrome.
>
> If you had the promise fail in the dev console, it's most likely because
> the dev console is not considered to be part of the foreground tab.
>
> When testing, I use the following snippet:
>
> write = function() {navigator.clipboard.writeText("sample text").then(function(){console.log("copied to clipboard");}, function() {console.log("not copied to clipboard");});}
> setTimeout(write, 5000)
>
> and then I switch to the main tab during the 5 sec timer.
>
> These failures (missing gesture, not active tab) will likely vary for
> different UAs, but it seems like we could define a set of standard failures
> that the UAs could return:
>
>    - Permission not granted
>    - User gesture not present
>    - Tab not the currently active tab
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <https://github.com/w3c/clipboard-apis/issues/66#issuecomment-365724979>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AAREqFUQe3N1dWTZEK3hM3HMsqI9KLCDks5tUzlcgaJpZM4SF2b1>
> .
>


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/clipboard-apis/issues/66#issuecomment-365725751

Received on Wednesday, 14 February 2018 19:54:51 UTC