Skip to content

[bug] Copy message button does not work on web interface #27992

Closed

Description

@SpiritChen51

Description

On the web interface, clicking the "Copy" button on a message does not copy the content to the clipboard. This happens because navigator.clipboard.writeText() can fail in non-secure contexts (non-HTTPS) or when the clipboard API is blocked by browser permissions.

Steps to reproduce

  1. Open the OpenCode web interface
  2. Click the copy button on any message
  3. The button does not copy the content and no feedback is shown

Fix

Added a fallback using the traditional document.execCommand("copy") method via a temporary textarea element, which works even when the Clipboard API is unavailable. Also added a check to only update the "copied" state if the copy actually succeeded.

Operating System

All platforms

Terminal/Environment

Web browser

Activity

  1. github-actions commented on May 17, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Please review that issue and consider whether your report adds anything new. If so, feel free to clarify the distinction.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions