Skip to content

fix: Forward data-* attributes to inner button element in copy-to-clipboard#4329

Draft
Who-is-PS wants to merge 1 commit intomainfrom
dev-v3-philosr-AWSUI-61782
Draft

fix: Forward data-* attributes to inner button element in copy-to-clipboard#4329
Who-is-PS wants to merge 1 commit intomainfrom
dev-v3-philosr-AWSUI-61782

Conversation

@Who-is-PS
Copy link
Member

@Who-is-PS Who-is-PS commented Mar 4, 2026

Description

Problem

data-* attributes passed to CopyToClipboard (e.g. data-analytics-type, data-analytics) are only
applied to the outer <span> wrapper via getBaseProps(). The actual clickable <button> element is nested
inside an InternalPopover, several DOM layers deep. Analytics tools like Panorama that rely on data-*
attributes being on or near the click target cannot associate click events with the analytics metadata,
resulting in empty values in dashboards.

Root Cause

Unlike components like Button (where the root element IS the interactive <button>), CopyToClipboard
has a passive <span> root with the click target buried inside a Popover:

Related links, issue #, if available: n/a

How has this been tested?

Review checklist

The following items are to be evaluated by the author(s) and the reviewer(s).

Correctness

  • Changes include appropriate documentation updates.
  • Changes are backward-compatible if not indicated, see CONTRIBUTING.md.
  • Changes do not include unsupported browser features, see CONTRIBUTING.md.
  • Changes were manually tested for accessibility, see accessibility guidelines.

Security

Testing

  • Changes are covered with new/existing unit tests?
  • Changes are covered with new/existing integration tests?

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@Who-is-PS Who-is-PS changed the title fix for copyclipboard fix: Forward data-* attributes to inner button element in copy-to-clipboard Mar 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant