Fix the empty-state "copy prompt" rows not working when OK runs inside…#201
Merged
Conversation
…956) * fix(open-knowledge): embedded-host copy-prompt clipboard fallback The empty-state CopyablePromptList copy buttons called navigator.clipboard.writeText directly with a silent catch. Inside an embedded host iframe (e.g. Claude) the parent frame's Permissions-Policy denies clipboard-write, so the async write rejected and nothing copied — the row never even flipped to "Copied". Route the copy through the shared scheduleClipboardWrite adapter (same as the Share flow), whose execCommand fallback fires under the click's transient activation where the policy-gated async API is refused. Add a dom regression test pinning both the happy path and the embedded-iframe rejection path. * test(open-knowledge): restore execCommand stub + cover all-paths-refused branch Address review on CopyablePromptList.dom.test.tsx: - afterEach now deletes any document.execCommand stub a test installed, so a later test can't inherit a prior test's fallback behavior (mirrors the save/restore discipline in clipboard-adapter.test.ts). - Add a negative-path test: when the async write rejects AND execCommand returns false, the row must stay on "Copy" — pins the graceful-degradation contract of handleCopy's catch branch. --------- GitOrigin-RevId: 6bd766b873f984375a3000cefcccdf427ac9d853
Contributor
There was a problem hiding this comment.
Automated approval from agents-private public-mirror-sync (run: https://github.com/inkeep/agents-private/actions/runs/27768343374). Source of truth is the monorepo; direct edits on inkeep/open-knowledge are overwritten on next sync.
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.
Fix the empty-state "copy prompt" rows not working when OK runs inside an embedded host iframe (e.g. Claude). The copy buttons called the async Clipboard API directly, which the host frame's Permissions-Policy refuses inside an iframe — the rejection was swallowed silently, so nothing copied and the row never showed "Copied". The copy now routes through the shared clipboard adapter, whose
execCommandfallback succeeds under the click's user activation where the policy-gated async write is blocked.