Skip to content

Conversation

@ernst-dev
Copy link
Member

@ernst-dev ernst-dev commented Apr 2, 2025

Description

Original customer ask:

As of now, when CopyToClipboard uses inline variant, it will ignore copyButtonText and use textToCopy for both display and copy value.
Make inline variant to have different copyButtonText and textToCopy values like button variant.

Customer usecase:

When you want to display a date with CopyToClipboard, you may want to display the date in localized, readable format but allow copying in language agnostic, timezone agnostic way, for example, UTC format.
It's a problem because as shown in the screenshot, different variants have different icon color and hurts visual uniformity without good reasons.

Main problem:
With any custom implementation, i.e. combining SpaceBetween using the variant="icon" and a string, it will result in a grey icon, this is particularly a problem when used in conjunction with regular inline CopyToClipboard which has a blue icon like inside a SplitPanel with KeyValuePairs.

Solution:
Adds a new property: textToDisplay which allows for specifying a separate display value from the copy value for variant="inline".

This is achieved by assigning a string to textToDisplay and a separate string to textToCopy.

  • e.g. a Human readable date/time to display but a timestamp to copy

If content has no value then textToCopy will be displayed instead.

Related links, issue #, if available: n/a
AWSUI-45434
65TZAG3kNuqE

How has this been tested?

  • Manual
  • Unit
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.

@codecov
Copy link

codecov bot commented Apr 2, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.51%. Comparing base (4e31a2f) to head (30024ce).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3400   +/-   ##
=======================================
  Coverage   96.51%   96.51%           
=======================================
  Files         806      806           
  Lines       23028    23031    +3     
  Branches     7550     7551    +1     
=======================================
+ Hits        22226    22229    +3     
  Misses        795      795           
  Partials        7        7           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this is such a large diff because of this change: #3413

@ernst-dev ernst-dev force-pushed the copy-to-clipboard-inline-content branch from 3bc12c7 to 14ad304 Compare April 10, 2025 11:28
@ernst-dev ernst-dev marked this pull request as ready for review April 14, 2025 09:13
@ernst-dev ernst-dev requested a review from a team as a code owner April 14, 2025 09:13
@ernst-dev ernst-dev removed the request for review from a team April 14, 2025 09:13
@ernst-dev ernst-dev added this pull request to the merge queue Apr 15, 2025
Merged via the queue into main with commit 1cb63cb Apr 15, 2025
38 checks passed
@ernst-dev ernst-dev deleted the copy-to-clipboard-inline-content branch April 15, 2025 12:59
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.

3 participants