Re: [w3c/clipboard-apis] Don't recommend user gesture in clipboard API (#75)

Thanks for your fast response.

> Anything supporting transient activation should work fine in our scenarios, if I'm reading that description correctly¹. Assuming the transient activation duration is long enough to cover sending the notification over the network, having the remote applications react, and send a request back.
> 
> What won't work is things that must be done before returning from an event handler. We are simply too asynchronous for that. And it was my understanding that this was/is how some user activated things are blocked?
> 

Yes, Safari apparently requires calling `clipboard.readText()` from an event handler, which corresponds to the user gesture (see "Security and Privacy" at https://webkit.org/blog/10855/).

For Gecko/Firefox, I'm currently considering to allow calling `clipboard.readText()` outside of such event handlers, limited to the same frame (or same origin) and  as long as it's called within the [transient activation duration](https://html.spec.whatwg.org/multipage/interaction.html#transient-activation-duration).
If I understand correctly, that should cover your use-case.

But I'm wondering, couldn't your application use an [async](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function) event handler and [wait](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await) for the result in there?

> ¹ There might be some corner cases, but I would assume 99% of applications only do clipboard operations as a result of a keyboard key or mouse button

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/clipboard-apis/issues/75#issuecomment-1079020750

You are receiving this because you are subscribed to this thread.

Message ID: <w3c/clipboard-apis/issues/75/1079020750@github.com>

Received on Friday, 25 March 2022 13:19:51 UTC