← Back to release summary

Support creating ClipboardItem with Promise<DOMString>

Category
Miscellaneous
Type
Chromium catches up
Status
Enabled by default (Chrome 133)
Intent stage
None

Summary

The ClipboardItem, which is the input to the async clipboard write method, now accepts string values in addition to Blobs in its constructor. ClipboardItemData can be a Blob, a string, or a Promise that resolves to either a Blob or a string.

Motivation

The current implementation of the ClipboardItem constructor accepts data as either a Blob or a Promise<Blob>. However, according to the Clipboard API specification, the constructor should accept ClipboardItemData, which can include Promise<(DOMString or Blob)>. Currently, developers must convert any string into a Blob before passing it to the constructor. Enabling this feature to accept string values simplifies creating ClipboardItem, making it more ergonomic. Both Safari and Firefox already support this functionality. Chromium adopting this feature will enhance interoperability across browsers, providing a more consistent experience for web authors.

Standards & signals

View on chromestatus.com