Skip to content

[OSS→OHE parity] Make OHE's copy buttons work without the Clipboard API #1462

Open

Description

@openhands-agent

In plain words

OSS: The copy buttons copy the text, even when the page is served over plain HTTP.
OHE: On a plain-HTTP install, the copy buttons in chat and in code blocks fail, and so does the share-link copy.

Gap

  • OSS change: OpenHands/OpenHands#18583 — fix(clipboard): support fallback when Clipboard API is unavailable (shipped in v1.42.0 #19819; fixes OpenHands/OpenHands#18582)
  • OSS paths: src/utils/copy-to-clipboard.ts, src/components/features/chat/chat-message.tsx, src/components/shared/buttons/copyable-content-wrapper.tsx, src/hooks/use-conversation-name-context-menu.ts
  • Gap key: gap:canvas/v1.35.0..main/clipboard-fallback#18583 · blocker type missing-integration
  • Evidence: static inspection of enterprise main at ac70934. Needs live validation: no.

What OHE is missing

navigator.clipboard exists only in a secure context. On a page served over plain HTTP from a non-loopback host it is undefined, so navigator.clipboard.writeText(...) throws. The OSS change adds one copyToClipboard helper. It tries the async API, falls back to a temporary textarea and execCommand("copy"), and returns whether the text reached the clipboard. The buttons then show "copied" only after a real copy.

OHE has its own copies of three of those call sites, and each still calls navigator.clipboard.writeText directly. The pin bump does not change them. On a plain-HTTP, non-loopback install, the copy button on a chat message and on a code block throws and does nothing. The "copy share link" menu entry throws before its success toast, so it shows nothing. The Compose stack serves the page at the address set in AGENT_CANVAS_LOCK_TO_CLOUD, and that address does not have to be loopback (docker-compose.yml#L174).

Where it belongs in OHE

No settings scope applies: this is a frontend utility change in the legacy frontend/, which the Canvas bundle does not replace.

Target files:

OHE principles that apply

  • P10 Change the right frontend: these components are in the legacy frontend/, not in the /canvas bundle. The pin bump does not change them, so the fix is a port into frontend/src/.

Acceptance

  • On a page served over plain HTTP from a non-loopback address, the copy button on a chat message and on a code block puts the text on the clipboard, and shows "copied" only after it did.
  • "Copy share link" copies the link and shows its success toast.
  • A unit test runs the helper with navigator.clipboard removed, and checks that the fallback copies the text and returns true.

Dependencies

None. The fix does not need the Canvas pin to move. OSS is still refining the helper in OpenHands/OpenHands#19843 (focus-independent fallback, one shared error toast). Port the version on OSS main when you start.

Duplicate check

Searched OpenHands/enterprise issues and pull requests, in any state, for 18583, 18582, clipboard, navigator.clipboard, execCommand, secure context, copy button and plain HTTP, and for the parity marker of this gap. No enterprise issue or pull request covers it. enterprise#1435 and enterprise#1459 mention the clipboard but add new copy controls and do not touch these three files. The closest hit is the OSS bug OpenHands/OpenHands#18582 (closed), the report that the OSS change fixes.


This issue was created by an AI agent (OpenHands) via the OHE OSS gap discovery automation.

Activity

  1. added
    oss-ohe-parity
    on Nov 19, 2026
  2. rajshah4 commented on Nov 19, 2026

    @rajshah4
    Member

    The same plain-HTTP limitation applies to Copy version info in #1459. Once #1463 lands, we can switch the About button to the shared copyToClipboard helper and test it with the Clipboard API unavailable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    oss-ohe-parity

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions