Skip to content

Fix the empty-state "copy prompt" rows not working when OK runs inside…#201

Merged
inkeep-oss-sync[bot] merged 1 commit into
mainfrom
copybara/sync
Jun 18, 2026
Merged

Fix the empty-state "copy prompt" rows not working when OK runs inside…#201
inkeep-oss-sync[bot] merged 1 commit into
mainfrom
copybara/sync

Conversation

@inkeep-oss-sync

Copy link
Copy Markdown
Contributor

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 execCommand fallback succeeds under the click's user activation where the policy-gated async write is blocked.

…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

@inkeep-internal-ci inkeep-internal-ci Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@inkeep-oss-sync inkeep-oss-sync Bot merged commit ad64aa1 into main Jun 18, 2026
@inkeep-oss-sync inkeep-oss-sync Bot deleted the copybara/sync branch June 18, 2026 15:01
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.

1 participant