From e9f85766fd1640bec75149097d6bf221b77c2ec6 Mon Sep 17 00:00:00 2001 From: Philipp Schneider Date: Wed, 4 Mar 2026 20:56:39 +0100 Subject: [PATCH] fix for copyclipboard --- src/copy-to-clipboard/internal.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/copy-to-clipboard/internal.tsx b/src/copy-to-clipboard/internal.tsx index 097f68eb8c..a4904a6d4e 100644 --- a/src/copy-to-clipboard/internal.tsx +++ b/src/copy-to-clipboard/internal.tsx @@ -52,6 +52,14 @@ export default function InternalCopyToClipboard({ }, [copyErrorText]); const baseProps = getBaseProps(restProps); + + // Extract data-* attributes to forward to the inner button for analytics support. + const dataAttributes: Record = {}; + Object.keys(restProps).forEach(key => { + if (key.match(/^data-/)) { + dataAttributes[key] = (restProps as Record)[key]; + } + }); const onClick = () => { if (!navigator.clipboard) { // The clipboard API is not available in insecure contexts. @@ -87,6 +95,7 @@ export default function InternalCopyToClipboard({ const button = (