← 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

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

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