Re: [w3c/clipboard-apis] What happens if promises to Blobs are not resolved within a reasonable amount of time? (Issue #161)

Thanks for raising those questions. Very important.

> `ClipboardItem` has `ClipboardItemDataType` which is a `Promise` to `Blob or DOMString`. When web authors don't resolve these promises in a reasonable amount of time, what should the Browser do in that case?

It seems reasonable to consider relevant use cases to determine how browsers should behave in that case. Perhaps it's reasonable to assume that web-devs either
1) write small amounts of data to the clipboard, so that they can resolve those promises in "a reasonable amount of time". A few seconds seems reasonable.
2) write large amounts of data to the clipboard, which they can prepare before calling `clipboard.write`.

However, I don't know if 2) is true in practice. @AshleyScirra: since you seem to be a web-dev, if you could contribute relevant use cases, that'd be helpful.

> Also, what happens if the promises to Blobs are resolved after the Browser Window loses focus?

Interesting question. One reason to use the async clipboard API is that it doesn't block (mentioned e.g. at https://www.tiny.cloud/blog/new-async-clipboard-api/). So that could mean, a use case for end users could be to trigger a `write()`, but knowing that it may take time, switch to another application. So for that use-case it would be annoying to cancel the `write()`.

> or user switches to another tab (while the promises are still not resolved in the first tab), opens the same site and starts another copy? Should we add a check to verify if the `Document` is active or not after the promises are resolved and before we write the payload to the clipboard? @whsieh @mbrodesser @BoCupp-Microsoft @mkruisselbrink

Perhaps it's reasonable to start with a short timeout, e.g. a few seconds, and not checking if the document is active. If, in practice it turns out to be an issue, one could still consider more subtle behavior and specification.





-- 
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/161#issuecomment-956163499

Received on Monday, 1 November 2021 11:43:33 UTC