Repository navigation
Let the remaining copy actions work where the page has no Clipboard API, and say when a copy fails - #959
Merged
Conversation
…PI, and say when a copy fails Signed-off-by: dada-yan <BinjunYann@gmail.com>
WaylandYang
approved these changes
Sep 26, 2026
WaylandYang
left a comment
Contributor
There was a problem hiding this comment.
Thank you for closing the loop on #954. One helper, four call sites, the Tokens button only saying Copied once it copied, and the failure wording in one place. Landing it. Thanks again.
WaylandYang
approved these changes
Sep 26, 2026
WaylandYang
left a comment
Contributor
There was a problem hiding this comment.
Maintainer review: sound, landing.
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.
This is the follow-up noted in the review of #954.
Problem
#954 gave the chat's copy actions
copyText. Wherenavigator.clipboarddoes not exist, as on a base opened over plain http on a local network, it falls back toexecCommand("copy").Four copy actions elsewhere still called the Clipboard API directly. On such a page each one breaks in its own way:
navigator.clipboard.writeTextwithout?., so the click throws aTypeErrorand nothing is shown.TypeError.?.makes it do nothing, yet the button still reads "Copied".Change
clipboard.ts: newcopyAndSay(text, copied).copyText, then shows a toast:copiedif the copy worked, or that it failed.errorCopied,tokenCopied,endpointCopied,account.copied). "Copy title" now says "Copied".CopyButtonswitches to "Copied" only after the copy worked. Before, it switched first and copied after.copyFailedmoves fromS.asktoS.toast, next to the other messages every page shares, so a failed copy is worded in one place. The chat's copy button reads it from there, and the text is unchanged.After this,
clipboard.tsis the only file inweb/srcthat touchesnavigator.clipboard.Verification
Run in containers on a Linux host: Node 20 with pnpm 10.2.1, and Playwright 1.58.2 with Chromium.
New tests
clipboard.test.tshas two new cases forcopyAndSay, each also checking the result it returns:S.toast.copyFailed.chat-view.test.mjs:On dev (aad5b06) with only the test changes
The new case fails in both rounds, waiting for a "Copied" that dev never shows: 24 tests, 22 pass, 2 fail (the case and its parent). The case stops at its first failing round, so it was run a second time with the rounds swapped. The vitest cases import the new function, so they were left out.
With this change
pnpm install --frozen-lockfilepasses.pnpm test: 189 passed.pnpm buildpasses, including style-guard andtsc.