Skip to content

fix: fall back when Clipboard API write fails - #196

Open
Hexagon0000 wants to merge 1 commit into
benjitaylor:mainfrom
Hexagon0000:fix/clipboard-fallback
Open

fix: fall back when Clipboard API write fails#196
Hexagon0000 wants to merge 1 commit into
benjitaylor:mainfrom
Hexagon0000:fix/clipboard-fallback

Conversation

@Hexagon0000

Copy link
Copy Markdown

Summary

  • Clipboard copy currently swallows navigator.clipboard.writeText failures and still shows the success checkmark, so users think feedback was copied when the clipboard is empty.
  • This is easy to hit in embedded browsers / unfocused documents (NotAllowedError: Document is not focused) and other non-secure or permission-restricted contexts.
  • Add copyTextToClipboard with an execCommand('copy') fallback, and only set the copied UI state when a write actually succeeds (while still always invoking onCopy).

Test plan

  • Unit tests for clipboard helper: API success, API fail → fallback success, both fail
  • Manual: add an annotation → Copy feedback → paste elsewhere matches markdown
  • Manual (if possible): block Clipboard API and confirm fallback still copies
  • Manual: when both paths fail, success checkmark does not appear; onCopy still fires

Made with Cursor

Clipboard copy swallowed writeText errors and still showed the success
checkmark. Add an execCommand fallback and only mark copied on success.
@vercel

vercel Bot commented Aug 10, 2026

Copy link
Copy Markdown

@Hexagon0000 is attempting to deploy a commit to the Benji Taylor's Projects Team on Vercel.

A member of the Team first needs to authorize it.

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.

1 participant