Clipboard.write() - only supports writing one ClipboardItem on Chrome/FF - #30507
Open
hamishwillee wants to merge 1 commit into
Open
hamishwillee wants to merge 1 commit into
hamishwillee wants to merge 1 commit into
Conversation
Contributor
|
Tip: Review these changes grouped by change (recommended for most PRs), or grouped by feature (for large PRs). |
This was referenced Sep 14, 2026
caugner
reviewed
Sep 15, 2026
| "From version 107, this method must be called within user gesture event handlers, or the user must grant the `clipboard-write` permission.", | ||
| "Before version 107, the user must grant the `clipboard-write` permission." | ||
| "Before version 107, the user must grant the `clipboard-write` permission.", | ||
| "Only supports writing one `ClipboardItem`." |
Contributor
There was a problem hiding this comment.
Is there a bug we could reference?
Could we mention what happens when writing more than one (NotAllowedError)?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Chrome and FF only support writing one ClipboardItem - tested using
(async (i = (t) => new ClipboardItem({ "text/plain": t })) => navigator.clipboard.write([i("a"), i("b")]).then(() => "resolved", (e) =>${e.name}: ${e.message}))().Safari allows writing as many as you like.
The spec says that you may write more than one item if the OS supports it but that if not only the first item may be writen.
But what happens on Chrome/FF is a NotAllowedError exception - the spec says that additional items should be ignored.
I added this as a note, but wondering if it should be a subfeature or this is OK? (or something else)
Related docs work can be tracked in mdn/content#45430