Intent to Implement and Ship: Async Clipboard API: Allow empty ClipboardItem during read

102 views
Skip to first unread message

Anupam Snigdha

unread,
Nov 21, 2023, 12:45:00 PM11/21/23
to blin...@chromium.org, Sanket Joshi (EDGE), Evan Stade, Joshua Bell

Contact emails

sni...@microsoft.com, est...@chromium.org, sa...@microsoft.com, jsb...@google.com


Explainer

https://docs.google.com/document/d/1OLVOESy3zecxY_6jMKdKVxeIGS2Q6mDmzc85rUNrRIE/edit?usp=sharing


Specification

https://w3c.github.io/clipboard-apis/#dom-clipboard-read


Design docs


Summary

When the system clipboard is either empty or has unsupported formats, paste event returns an empty DataTransfer object, but the promise for `navigator.clipboard.read()`API is rejected. This creates interop differences and confusion among web developers as they aren’t sure why read failed.


Currently in Chrome, we throw a DataError. The proposal here is to return an empty ClipboardItem when the system clipboard is either empty or there aren’t any supported formats.


Blink component

Blink>DataTransfer


Search tags

AsyncClipboardAPI, ClipboardItem


TAG review

None


TAG review status

Not applicable

It satisfies one of the criterias for exception. This change has already been shipped in Safari and Firefox has also implemented it. The spec already allows empty ClipboardItem during read so it doesn’t need any update. 



Risks



Interoperability and Compatibility

None. Safari has shipped this feature and Firefox has already implemented it.


Gecko: Positive (https://github.com/w3c/clipboard-apis/issues/179#issuecomment-1211995581)


WebKit: Shipped/Shipping (https://github.com/w3c/clipboard-apis/issues/179#issuecomment-1804303784)


Web developers: Positive This was a feedback from our partners at Office who are migrating from DataTransfer API to Async Clipboard API.


Other signals:


Ergonomics

N/A


Activation

N/A


Security

None. The proposal only returns an empty ClipboardItem instead of rejecting the promise returned from the read() method when the clipboard is empty, so there isn’t any impact on the async clipboard API.


WebView application risks

Does this intent deprecate or change behavior of existing APIs, such that it has potentially high risk for Android WebView-based applications?

None



Debuggability

Existing devtools support should suffice.


Will this feature be supported on all six Blink platforms (Windows, Mac, Linux, Chrome OS, Android, and Android WebView)?

Yes


Is this feature fully tested by web-platform-tests?

No

Currently emptying the clipboard is not exposed to the web, so it's not possible to add a WPT test for it.


Flag name on chrome://flags

None


Finch feature name

None


Non-finch justification

None


Requires code in //chrome?

False


Tracking bug

https://bugs.chromium.org/p/chromium/issues/detail?id=1500440


Sample links


https://flash-lateral-nylon.glitch.me


Estimated milestones

Shipping on desktop

121


Shipping on Android

121



Link to entry on the Chrome Platform Status

https://chromestatus.com/feature/5192271976988672


This intent message was generated by Chrome Platform Status.




Thanks,
Anupam

Sent from Outlook

Yoav Weiss

unread,
Nov 29, 2023, 11:27:29 AM11/29/23
to blink-dev, snianu, Sanket Joshi (Edge), Evan Stade, Joshua Bell
LGTM1

This seems to reduce interop risk. Thanks!

Chris Harrelson

unread,
Nov 29, 2023, 12:02:15 PM11/29/23
to Yoav Weiss, blink-dev, snianu, Sanket Joshi (Edge), Evan Stade, Joshua Bell
LGTM2

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/2adf2536-daac-401a-8292-c65317d82fd3n%40chromium.org.

Daniel Bratell

unread,
Nov 29, 2023, 12:03:23 PM11/29/23
to Chris Harrelson, Yoav Weiss, blink-dev, snianu, Sanket Joshi (Edge), Evan Stade, Joshua Bell
Reply all
Reply to author
Forward
0 new messages