fix(web): clipboard fallback for non-secure contexts (e.g. port-forwarding)#1448
Draft
zhiyuan1i wants to merge 1 commit intoMoonshotAI:mainfrom
Draft
fix(web): clipboard fallback for non-secure contexts (e.g. port-forwarding)#1448zhiyuan1i wants to merge 1 commit intoMoonshotAI:mainfrom
zhiyuan1i wants to merge 1 commit intoMoonshotAI:mainfrom
Conversation
e1c2bf6 to
acefd46
Compare
…rding)
navigator.clipboard.writeText requires a secure context (HTTPS or
localhost). When the web UI is accessed via VS Code port-forwarding or
similar tunnels, the browser may block the Clipboard API silently.
Add a shared copyToClipboard() utility that tries the modern API first
and falls back to document.execCommand("copy") with a hidden textarea.
Replace all 6 direct navigator.clipboard.writeText calls with it.
acefd46 to
5fa75f0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Issue
Description
Bug: The copy buttons throughout the web UI silently fail when accessed via VS Code remote port-forwarding (or similar tunnels), because
navigator.clipboard.writeText()requires a secure context (HTTPS orlocalhost).Fix: Add a shared
copyToClipboard()utility (web/src/lib/clipboard.ts) that:navigator.clipboard.writeText()first (modern API).document.execCommand("copy")with a hidden textarea when the modern API is unavailable or rejected.All 6 direct
navigator.clipboard.writeText()call sites are replaced with the new utility:code-block.tsx— code block copy buttonmessage.tsx— message copy buttonerror-boundary.tsx— error copy buttonsession-info-popover.tsx— session info copyopen-in-button.tsx— path copyopen-in-menu.tsx— working dir copyChecklist
make gen-changelogto update the changelog.make gen-docsto update the user documentation.