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

Document how to set clipboard-write permission #6156

Merged
merged 1 commit into from
Jan 31, 2024

Conversation

acelaya
Copy link
Contributor

@acelaya acelaya commented Jan 30, 2024

As noted in #6155 (comment), this PR documents the need to allow clipboard-write and how to do it, when loading Hypothesis inside an iframe.

This is needed for the various places in which content can be copied to the clipboard.

This is how the rendered content looks like, but it can be tested by running make docs and going to http://127.0.0.1:8000/publishers/embedding/#clipboard-permissions-when-loaded-in-an-iframe

image

@acelaya acelaya force-pushed the document-clipboard-permissions branch from dab5b92 to 298dd0e Compare January 30, 2024 14:11
Copy link

codecov bot commented Jan 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (a185d1e) 99.44% compared to head (f0f08c2) 99.44%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6156   +/-   ##
=======================================
  Coverage   99.44%   99.44%           
=======================================
  Files         263      263           
  Lines       10099    10099           
  Branches     2412     2412           
=======================================
  Hits        10043    10043           
  Misses         56       56           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@robertknight
Copy link
Member

The clipboard-write permission is currently a Chrome-specific requirement, and was removed from the official spec. See w3c/permissions#246 and linked issues. Safari and Firefox only require a user activation. See also https://caniuse.com/?search=clipboard.writeText.

I think we can address this by changing "requires the clipboard-write permission" to "requires the clipboard-write permission in Chrome (but not Safari or Firefox)".

@robertknight
Copy link
Member

I commented in w3c/clipboard-apis#163 (comment) to see if anything can be done about changing Chrome's behavior so this extra step isn't needed.

@acelaya acelaya force-pushed the document-clipboard-permissions branch from 298dd0e to 16cf839 Compare January 31, 2024 09:30
@acelaya
Copy link
Contributor Author

acelaya commented Jan 31, 2024

I think we can address this by changing "requires the clipboard-write permission" to "requires the clipboard-write permission in Chrome (but not Safari or Firefox)".

@robertknight I pushed this.

docs/publishers/embedding.rst Outdated Show resolved Hide resolved
docs/publishers/embedding.rst Outdated Show resolved Hide resolved
docs/publishers/embedding.rst Outdated Show resolved Hide resolved
docs/publishers/embedding.rst Outdated Show resolved Hide resolved

.. code-block:: html

<iframe allow="clipboard-write">
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if we should generalize this section to include other permissions that are relevant. The clipboard is the main one, but there is also the fullscreen permission for embedded media.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I thought about that. Let's merge this one and I'll create an issue to extend this and make it more generic.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done #6157

docs/publishers/embedding.rst Show resolved Hide resolved
Copy link
Member

@robertknight robertknight left a comment

Choose a reason for hiding this comment

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

LGTM

@acelaya acelaya merged commit 89409e5 into main Jan 31, 2024
4 checks passed
@acelaya acelaya deleted the document-clipboard-permissions branch January 31, 2024 13:04
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.

2 participants