Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow empty ClipboardItem. #198

Closed
wants to merge 1 commit into from
Closed

Allow empty ClipboardItem. #198

wants to merge 1 commit into from

Conversation

snianu
Copy link
Contributor

@snianu snianu commented Nov 7, 2023

Closes #179

For normative changes, the following tasks have been completed:

  • Modified Web platform tests (link to pull request)

Implementation commitment:


Preview | Diff

@snianu snianu requested a review from sanketj November 7, 2023 23:32
@snianu
Copy link
Contributor Author

snianu commented Nov 7, 2023

@evanstade Please let me know if you have any concern with this change, thanks!

@@ -654,7 +654,6 @@ url: https://w3c.github.io/permissions/#permissions-task-source; type: dfn;
1. Set |clipboardItemObject|'s [=/clipboard item=] to |clipboardItem|.

The <dfn constructor for="ClipboardItem" lt="ClipboardItem(items, options)"><code>new ClipboardItem(<var>items</var>, <var>options</var>)</code></dfn> constructor steps are:
1. If |items| is empty, then throw a {{TypeError}}.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the behavior on other browsers? Are they compliant with the spec after this update?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@snianu
Copy link
Contributor Author

snianu commented Nov 8, 2023

I'm not sure if this change is actually required as the existing algorithm in read() already handles the empty clipboard state. We do want to prevent write() method from writing empty ClipboardItems as it is not clear what the result should be in those scenarios - do we clear the clipboard or write supported formats with empty data or do nothing? I'm going to abandon this change but please let me know if I'm missing anything.

@snianu snianu added the Agenda+ label Nov 8, 2023
@snianu
Copy link
Contributor Author

snianu commented Nov 9, 2023

Abandoning this PR as per the resolution in the EditingWG meeting.
[17:25] next up: #198
[17:26] trying to speak
[17:26] can you hear me?
[17:26] snianu: audio issues, let's move on for now
[17:26] snianu: nvm audio issues fixed!
[17:27] snianu: if clipboard item is empty and developer writes to clipboard, the write will throw an exception in Chrome but FF/WebKit allows that
[17:28] s/clipboard item is empty/clipboard item list is empty/
[17:28] snianu: creates confusion for web dev since it's unclear if they need to retry, or…
[17:28] q+
[17:29] q+
[17:29] s/developer writes to clipboard/developer reads from clipboard/
[17:29] q-
[17:29] snianu: read should not throw exception, write should throw exception
[17:30] snianu: with current DT APIs dev cannot clear clipboard by writing
[17:30] snianu: with async clipboard API you can write empty item (?)
[17:30] snianu: maybe flag to indicate that clipboard item is intentionally "empty"
[17:30] q+
[17:32] whsieh: if we want to expose a "clear clipboard" API, it should probably be navigator.clipboard.clear() or something
[17:33] johanneswilm: seems we're all in agreement
[17:33] sanketj_: to summarize, allow read empty items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Should reading the clipboard throw DataError or empty clipboard items?
2 participants