From 84c947d19a4c4fff7b134eae4ac46c92622fe4e4 Mon Sep 17 00:00:00 2001 From: Chris Scott <99081550+chriswritescode-dev@users.noreply.github.com> Date: Sun, 4 Jan 2026 17:42:16 -0500 Subject: [PATCH] Add fallback copy method for non-HTTPS clipboard access --- frontend/src/components/ui/copy-button.tsx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/ui/copy-button.tsx b/frontend/src/components/ui/copy-button.tsx index 01ef862e..1ade7713 100644 --- a/frontend/src/components/ui/copy-button.tsx +++ b/frontend/src/components/ui/copy-button.tsx @@ -26,7 +26,21 @@ export function CopyButton({ setCopied(true) setTimeout(() => setCopied(false), 2000) } catch { - // Clipboard access denied or not supported + const textArea = document.createElement('textarea') + textArea.value = content + textArea.style.position = 'fixed' + textArea.style.left = '-9999px' + document.body.appendChild(textArea) + textArea.select() + try { + const successful = document.execCommand('copy') + if (successful) { + setCopied(true) + setTimeout(() => setCopied(false), 2000) + } + } finally { + document.body.removeChild(textArea) + } } }