Skip to content

Fix clipboard copy on insecure origins - #1589

Open
Willhong wants to merge 1 commit into
get-bb:mainfrom
Willhong:agent/fix-copy-on-http-origins
Open

Fix clipboard copy on insecure origins#1589
Willhong wants to merge 1 commit into
get-bb:mainfrom
Willhong:agent/fix-copy-on-http-origins

Conversation

@Willhong

@Willhong Willhong commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Summary

  • fall back to a temporary textarea and the browser editing command when the async Clipboard API is unavailable or rejects
  • restore the prior focus and document selection after the fallback attempt
  • cover modern API success, unavailable/rejected API fallback, cleanup, focus restoration, and final error reporting

Root cause

bb can be opened over a plain-HTTP LAN origin, while navigator.clipboard.writeText() is restricted to secure contexts in browsers. The shared copy helper treated an unavailable or rejected Clipboard API as a terminal failure, so every copy affordance backed by that helper displayed Failed to copy on those origins.

User impact

Copy actions now continue to use the modern Clipboard API on secure origins and retain a user-gesture fallback for LAN HTTP access. A failure toast is shown only when both strategies fail.

Fixes #1590

Validation

  • pnpm exec turbo run typecheck --filter=@bb/app --force
  • pnpm exec turbo run lint --filter=@bb/app --force (0 errors; existing warnings remain)
  • pnpm exec vitest run --config vitest.config.ts src/lib/clipboard.test.ts (5 passed)
  • full @bb/app test run: 2,709 passed; one unrelated iPadOS typeahead test failed once and passed when rerun in isolation

AGENT GENERATED: by GPT-5.6 Sol

@Willhong
Willhong marked this pull request as ready for review August 14, 2026 05:51
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.

Clipboard copy actions fail on plain-HTTP LAN origins

1 participant