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
- Open the OpenCode web interface
- Click the copy button on any message
- 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
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
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