[Integrate-2755] add copy tooltip and tick feedback to Text component copy button - #3046
Open
suwarnoong wants to merge 1 commit into
Open
[Integrate-2755] add copy tooltip and tick feedback to Text component copy button#3046suwarnoong wants to merge 1 commit into
suwarnoong wants to merge 1 commit into
Conversation
suwarnoong
requested review from
SantanM,
hengxian-jiang and
p-hoffmann
as code owners
August 4, 2026 07:46
Contributor
There was a problem hiding this comment.
Pull request overview
Adds UX feedback for the Text component’s copy button in portal-components, including a hover tooltip and a temporary “copied” checkmark state after clicking copy.
Changes:
- Add tooltip-wrapped copy button UI and a 3s “copied” feedback state in
Text. - Add Jest/RTL tests for tooltip visibility, icon swap timing, repeated clicks, and unmount cleanup.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| plugins/ui/libs/portal-components/src/components/Text/Text.tsx | Adds tooltip + “copied” feedback state to the Text copy button. |
| plugins/ui/libs/portal-components/src/components/Text/tests/Text.test.tsx | Adds unit tests covering tooltip and copied-state timing/reset behavior. |
Comment on lines
32
to
40
| const handleCopyString = useCallback((content: string) => { | ||
| navigator.clipboard.writeText(content); | ||
| setCopied(true); | ||
| if (resetTimeoutRef.current) clearTimeout(resetTimeoutRef.current); | ||
| resetTimeoutRef.current = setTimeout(() => { | ||
| setCopied(false); | ||
| resetTimeoutRef.current = null; | ||
| }, COPY_FEEDBACK_DURATION_MS); | ||
| }, []); |
Comment on lines
+60
to
+63
| <IconButton | ||
| startIcon={copied ? <CheckIcon width={24} height={24} /> : <CopyIcon width={24} height={24} />} | ||
| onClick={() => handleCopyString(props.children)} | ||
| /> |
Comment on lines
+7
to
+17
| beforeEach(() => { | ||
| writeText.mockClear(); | ||
| // navigator.clipboard is non-writable in jsdom by default, so it must be | ||
| // redefined rather than assigned — same pattern used in | ||
| // apps/vue-mri-ui-lib/src/utils/__tests__/CohortUrlCodec.test.ts. | ||
| Object.defineProperty(navigator, "clipboard", { | ||
| value: { writeText }, | ||
| writable: true, | ||
| configurable: true, | ||
| }); | ||
| }); |
Comment on lines
+25
to
+29
| // Both CopyIcon and CheckIcon render their meaningful path with fill="navy" — | ||
| // CheckIcon also renders an unfilled background rect path, so this selector | ||
| // (not a plain "svg path") is what actually distinguishes the two icons. | ||
| function getIconPathData(button: HTMLButtonElement) { | ||
| return button.querySelector('svg path[fill="navy"]')?.getAttribute("d") ?? ""; |
SantanM
approved these changes
Aug 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Merge Checklist
Screen.Recording.2026-08-04.at.16.07.05.mov
Please cross check this list if additions / modifications needs to be done on top of your core changes and tick them off. Reviewer can as well glance through and help the developer if something is missed out.
developbranch)