From 4bcf2ae830f0d4e28327d5afce007a2574132fc6 Mon Sep 17 00:00:00 2001 From: Dennis Reimann Date: Mon, 17 Mar 2025 19:29:18 +0100 Subject: [PATCH] UI: Prevent copy to clipboard double-clicks As long as the copy confirmation is shown, it should not allow the handler to be called again. Fixes #6632. --- BTCPayServer/wwwroot/js/copy-to-clipboard.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/BTCPayServer/wwwroot/js/copy-to-clipboard.js b/BTCPayServer/wwwroot/js/copy-to-clipboard.js index e38567d86..b4a3225fe 100644 --- a/BTCPayServer/wwwroot/js/copy-to-clipboard.js +++ b/BTCPayServer/wwwroot/js/copy-to-clipboard.js @@ -1,4 +1,5 @@ function confirmCopy(el, message) { + if (el.dataset.clipboardConfirming) return; const hasIcon = !!el.innerHTML.match('icon-actions-copy') const confirmHTML = `${message}`; if (hasIcon) { @@ -10,7 +11,7 @@ function confirmCopy(el, message) { el.style.minHeight = height + 'px'; el.innerHTML = confirmHTML; } - el.dataset.clipboardConfirming = true; + el.dataset.clipboardConfirming = 'true'; if (el.dataset.clipboardHandler) { clearTimeout(parseInt(el.dataset.clipboardHandler)); }