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
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions docs/publishers/embedding.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,28 @@ document and have the same origin.

The client will watch for new iframes being added to the document and will
automatically enable annotation for them.


Clipboard permissions when loaded in an iframe
----------------------------------------------

There are a few places in the sidebar where the user can copy content to the
clipboard, such as exporting or copying links to annotations.

This functionality uses the browser's
`Clipboard API <https://developer.mozilla.org/en-US/docs/Web/API/Clipboard_API>`_,
which requires allowing the ``clipboard-write`` permission in Chrome (but not
Safari or Firefox).

When loading the sidebar in the top-level document, this will work automatically
but if you load Hypothesis inside an iframe, you will need to add an ``allow``
attribute with the right permissions.

.. 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

<!-- Hypothesis is loaded here -->
</iframe>
acelaya marked this conversation as resolved.
Show resolved Hide resolved

If these permissions are not available, the corresponding functionality in
Hypothesis will either be unavailable or will fail with an error when used.
Loading