← Back to release summary

Async Clipboard API: Allow empty ClipboardItem during read

Category
Miscellaneous
Type
Chromium catches up
Status
In development (Chrome In development)
Intent stage
None

WPT details: Currently emptying the clipboard is not exposed to the web, so it's not possible to add a WPT test for it. However we have added browser tests in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/5010104

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.

Motivation

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. Explainer: https://docs.google.com/document/d/1OLVOESy3zecxY_6jMKdKVxeIGS2Q6mDmzc85rUNrRIE/edit?usp=sharing

Standards & signals

Ecosystem

Docs: https://github.com/w3c/clipboard-apis/issues/179 https://docs.google.com/document/d/1OLVOESy3zecxY_6jMKdKVxeIGS2Q6mDmzc85rUNrRIE/edit?usp=sharing

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

View on chromestatus.com