fix(ui): copy to the clipboard outside a secure context - #2866
Open
Charlesthebird wants to merge 2 commits into
Open
Charlesthebird wants to merge 2 commits into
Charlesthebird wants to merge 2 commits into
Conversation
`navigator.clipboard` is undefined over plain http from anything but localhost, so every copy button rejected there: the tool result and the code block reported nothing, the LLM-call JSON dropped the rejection on the floor, and the share dialog claimed success it had not checked. `copyText` answers the document's own `copy` event instead, which needs no focus and so survives a dialog's focus trap, and returns whether the event actually fired — `execCommand` returns true for copying nothing. Callers now report failure rather than implying a copy. This is the other half of #1868, which fixed `crypto.randomUUID` for the same deployments and left the clipboard alone. Signed-off-by: Nicholas Bucher <[email protected]>
|
Warning Testing pausedMonthly snapshot limit reached. Update your plan for additional snapshots and to resume testing. |
Charlesthebird
marked this pull request as ready for review
September 18, 2026 00:00
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.
🤖 written by Claude (start)
Changelog
Copy buttons work on deployments served over plain http, and say so when a copy fails.
Testing
cd ui && npm run dev, then open the app on a LAN IP rather than localhost — that origin is not a secure context, sonavigator.clipboardis undefined.Additional Notes
This is the other half of #1868, which fixed
crypto.randomUUIDfor these deployments and left the clipboard alone. That fix is already here and needs no change.copyTextanswers the document's owncopyevent rather than selecting a borrowed textarea. Nothing needs focus, so it also works inside a dialog that traps it — the share dialog's old fallback appended its textarea todocument.bodyand copied nothing there while reporting success.Success is the event having fired, not what
execCommandreturns: it returns true for copying nothing.🤖 written by Claude (end)