Skip to content

iframe allow list omits clipboard-write and web-share, breaking the player's Copy link / Share controls #331

Open

Description

@kh-ruslan

Describe the bug
The player iframe is rendered with

allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"

This list omits clipboard-write and web-share. YouTube's in-player Copy link button (the chain-link icon shown when hovering a playing video) and the Share control call navigator.clipboard.writeText / navigator.share from inside the cross-origin youtube.com frame. Permissions Policy grants those features to a cross-origin frame only when the embedding <iframe> delegates them through its allow attribute, so both controls fail.

The player shows the toast "Unable to copy link to clipboard" and Chrome logs:

[Violation] Permissions policy violation: The Clipboard API has been blocked because of a permissions policy applied to the current document. See https://crbug.com/414348233 for more details.

YouTube's own embed snippet (Share → Embed on any video) uses:

allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"

The same gap was reported and fixed in Mux's youtube-video-element (muxinc/media-elements#247 / #248).

To Reproduce

  1. Render <LiteYouTubeEmbed id="dQw4w9WgXcQ" title="Demo" /> and click to activate the player.
  2. Hover the playing video so the top overlay appears, and click the chain-link Copy link icon at the bottom left.
  3. Observe the "Unable to copy link to clipboard" toast and the Permissions Policy violation in the console.

Expected behavior
The video URL is copied to the clipboard, as it is with YouTube's default embed code.

Desktop

  • OS: Linux / Windows / macOS (any)
  • Browser: Chrome 140 (also applies to any browser enforcing Permissions Policy for clipboard-write)
  • Version: react-lite-youtube-embed 3.5.1 and 3.7.0

Additional context
There is currently no prop to customize the iframe allow attribute, so consumers cannot work around this without patching the package. Adding the two tokens to the hardcoded list matches YouTube's reference embed and is backward compatible. I have a PR ready.

Activity

  1. github-actions commented on Nov 18, 2026

    @github-actions
    Contributor

    👋 This issue has been automatically marked as stale because it has been inactive for 60 days.

    It will be closed in 14 days if no further activity occurs.

    If this issue is still relevant, please:

    • Add a comment explaining why it should remain open
    • Provide additional context or updates

    Thank you for your contributions! 🙏

  2. kh-ruslan commented on Nov 23, 2026

    @kh-ruslan
    Author

    Still relevant: the allow attribute on current main (137dc61) and in the latest release (3.7.0) still lacks clipboard-write and web-share, so the in-player Copy link button keeps failing with "Unable to copy link to clipboard".

    The fix is ready in #332, rebased onto current main today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions