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

FF122 Clipboard async API in preview/late beta #21667

Merged
merged 17 commits into from
Jan 22, 2024

Conversation

hamishwillee
Copy link
Collaborator

@hamishwillee hamishwillee commented Dec 19, 2023

FF122 enables the dom.events.asyncClipboard.clipboardItem and dom.events.asyncClipboard.readText on preview ( @IS_EARLY_BETA_OR_EARLIER@) in https://bugzilla.mozilla.org/show_bug.cgi?id=1809106

This updates the corresponding Clipboard and ClipboardItem interfaces to be in preview, deleting some of the older versions.

Note that it is in draft while I confirm some behaviours: https://bugzilla.mozilla.org/show_bug.cgi?id=1809106#c14

Related docs work can be tracked in mdn/content#31104

@github-actions github-actions bot added the data:api 🐇 Compat data for Web APIs. https://developer.mozilla.org/docs/Web/API label Dec 19, 2023
api/Clipboard.json Outdated Show resolved Hide resolved
api/Clipboard.json Outdated Show resolved Hide resolved
api/Clipboard.json Outdated Show resolved Hide resolved
api/Clipboard.json Outdated Show resolved Hide resolved
@hamishwillee hamishwillee changed the title Ff122 clipboard async FF122 Clipboard async API in preview/late beta Dec 28, 2023
api/Clipboard.json Outdated Show resolved Hide resolved
@kailando

This comment was marked as spam.

api/Clipboard.json Outdated Show resolved Hide resolved
api/Clipboard.json Outdated Show resolved Hide resolved
api/Clipboard.json Outdated Show resolved Hide resolved
api/Clipboard.json Outdated Show resolved Hide resolved
api/Clipboard.json Outdated Show resolved Hide resolved
api/Clipboard.json Outdated Show resolved Hide resolved
@hamishwillee hamishwillee marked this pull request as ready for review January 2, 2024 00:16
@hamishwillee
Copy link
Collaborator Author

I'm still waiting on confirmations on whether there are additional off-spec restrictions, but I think this is correct.

@hamishwillee
Copy link
Collaborator Author

@queengooborg @Elchi3 Any chance I could get some advice on this - not nagging - just aware I am away for a couple of weeks after Tuesday. If you can't do it, then no worries.

@hamishwillee
Copy link
Collaborator Author

hamishwillee commented Jan 5, 2024

EDITED.

Spec says

  • secure context for read write.
  • read clipboard with transient activation
  • read clipboard with prompt for content initiated from browser/OS "paste element" (i.e. a menu)
  • write with permission API, which may or may not require transient activation.

---Chromium---

This went in in 107 https://chromium.googlesource.com/chromium/src/+/10300ac7da93a7e322274f1e

  • Writes of plain text/image will require either a user gesture or a permission grant. (but no gesture if permission granted).
    Previously anything could be written anytime
  • Reading requires permission grant but no transient activation.

Also requires Permission-Policy from 85 https://chromestatus.com/feature/5767075295395840

There's a new API for reading unsanitised data https://chromestatus.com/feature/5716132676763648 in 122. It is Chrome only, and likely to remain Chrome only.

--- Firefox ---

  • Firefox requires secure context and transient activation to read or write to the clipboard.
  • It does not use, or plan to use Permission API permissions.
  • For reading, the spec expects a prompt when reading content due to interaction with a user-agent or browser paste element. Firefox suppresses this prompt when pasting content copied from a same-origin page.

The Firefox security considerations for Web Extensions are slightly different:

  • Reading text is only available for extensions with the Web Extension clipboardRead permission.
    With this permission the extension does not require transient activation or a paste prompt.
  • Writing text is available in secure context and transient activation.
    With the Web Extension clipboardWrite permission transient activation is not required.

Comment on lines +47 to +57
"chrome": {
"version_added": "66",
"partial_implementation": true,
"notes": [
"From version 86, the <code>text/html</code> MIME type is supported.",
"From version 85, Requires Permission-Policy <code>clipboard-read</code> permission.",
"From version 76, the <code>image/png</code> MIME type is supported.",
"From version 66, the <code>text/plain</code> MIME type is supported.",
"Requires Permission API <code>clipboard-read</code> permission. Does not require transient activation."
]
},
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

FYI, given that these are all partial implementations, combining the notes like this makes them much easier to use (this is what was done in the other methods). We could consider adding a subfeature for the supported MIME types.

Copy link
Member

Choose a reason for hiding this comment

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

I'm a bit unclear why Chrome is marked partial_implementation when other browsers have similar (amounts of) notes and aren't marked partial.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe "Does not require transient activation." is the thing that Chrome should have in order to be not-partial?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@Elchi3 TBH I did not modify partial and did not really think about it. TLDR; - my take is that probably should make this no longer partial - do you want me to take care of it?


I suspect that this was partial originally waiting on From version 85, Requires Permission-Policy clipboard-read permission.",. The spec now no longer requires clipboard-read so you could argue it should always have been full implementation. Either way we never remove "full implementation" due to later changes, so it should be full now.

The whole thing is messy because all the other browsers are using transient activation and never intend to implement permissions. The spec has PRs against it to change it this way, but they are unlikely to be accepted without consensus with Chrome. So you might argue that the other browsers are partial implementations against the current spec. I think that just complicates things so we'd best just make them all full.

If you need a more detailed explanation might be best to have a call with me or WillB who have worked through it.

Copy link
Member

Choose a reason for hiding this comment

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

TLDR; - my take is that probably should make this no longer partial - do you want me to take care of it?

yeah, I think we should treat everyone the same at least. Thanks for dealing with the messy compat story here.

api/Clipboard.json Outdated Show resolved Hide resolved
@hamishwillee
Copy link
Collaborator Author

Updated to reflect the information gathered in #21667 (comment).

It omits the new subfeatures discussed in https://chromestatus.com/feature/5716132676763648. I'll probably do those in a follow on.

api/Clipboard.json Outdated Show resolved Hide resolved
Copy link
Member

@Elchi3 Elchi3 left a comment

Choose a reason for hiding this comment

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

I'm going to merge this. It seems like an overall improvement and we can follow-up with more if needed.

@Elchi3 Elchi3 merged commit b80c12b into mdn:main Jan 22, 2024
6 checks passed
foolip added a commit to foolip/browser-compat-data that referenced this pull request Jul 10, 2024
This status for read() and readText() isn't clearly explained by the
notes, but seems to have been carried forward when merging compat
statements in mdn#21667.

Since the required formats are now supported, it doesn't make sense to
continue to claim partial implementation.

mdn#7991 would make this
clearer still.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data:api 🐇 Compat data for Web APIs. https://developer.mozilla.org/docs/Web/API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants