Frontend: CopyButton primitive (clipboard) #183
Labels
No labels
agent:fix_bugfix
agent:fix_conflicts
agent:fix_security
agent:gap_analysis
agent:implement
agent:implement
agent:implement
agent:open_issues
agent:ready
agent:research
agent:security_audit
agent:verify
architecture
backend
blocker:hybrid
blocker:launch
blocker:limit-orders
blocker:v2
block:log_only
block:security
bug
ci
contracts
correctness
deploy
dev
devops
docs
documentation
duplicate
e2e
enhancement
epic
feature
frontend
functional-completion
gas
good first issue
governance
help wanted
high-risk
hooks
hybrid
indexer
infra
infrastructure
integrators
invalid
launch-blocker
limit-orders
localnet
localterra
low priority
missing-implementation
needs-design
ops
performance
priority
high
priority
medium
product
qa
QA
question
ready
ready
research
scripts
security
security-hardening
smartcontracts
tech-debt
testing
ux
UX
v2
verification
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
code/cl8y-dex-terraclassic#183
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Extract a reusable
CopyButtonfor one-click clipboard copy. Required before wallet-chip copy and other address surfaces (GitLab #140 scope B — infra sibling).Context
navigator.clipboardusage infrontend-dapp/srctoday.TxResultAlerthas explorer but no copy).Acceptance criteria
aria-label, brief success feedback oraria-live).navigator.clipboard).docs/frontend.md+skills/AGENTS_FRONTEND_WALLET_CHIP.mdcross-link.Parent / related
cc @Brouie @PlasticDigits
marked as related to #140
mentioned in issue #185
marked as related to #185
mentioned in issue #188
marked as related to #188
mentioned in issue #140
mentioned in commit
574dfdf4e6mentioned in commit
854d0cd9c1mentioned in commit
a4d16f7bbfImplementation summary (GitLab #183)
Merged to
main(854d0cd): reusableCopyButtonclipboard primitive for address/contract/tx surfaces.Delivered
frontend-dapp/src/utils/copyToClipboard.ts— singlewriteTextpath (trim, injectable for Vitest)frontend-dapp/src/components/ui/CopyButton.tsx— accessible icon button,aria-label,aria-live="polite"success/failure feedback (2s reset)frontend-dapp/src/utils/copyButtonCopy.tscopyToClipboard.test.ts(mocksnavigator.clipboard),CopyButton.test.tsxdocs/frontend.md#copy-button-primitive,skills/AGENTS_FRONTEND_COPY_BUTTON.md, cross-links in wallet-chip skill +docs/README.mdNot in this MR (by design): wallet dropdown wiring — tracked in #185 (uses this primitive +
getExplorerAddressUrlfrom #184).Verification checklist
cd frontend-dapp && npm test -- --run src/utils/__tests__/copyToClipboard.test.ts src/components/ui/__tests__/CopyButton.test.tsx— all greenCopyButtonfrom@/components/ui; click copies trimmed text#copy-button-primitive, agent skill links fromAGENTS_FRONTEND_WALLET_CHIP.md@Brouie — please verify on your side when you have a moment. Leaving the issue open until #185 consumes the primitive in the wallet menu.
qa cleared at source+test layer @PlasticDigits
verified
854d0cd9.CopyButton.tsx — accessible button with aria-label, sr-only aria-live="polite" + aria-atomic="true" region announces success/failure, 2s reset to idle. Two variants: standalone icon + menuLabel row (role="menuitem") used by the wallet dropdown.
copyToClipboard.ts — single writeText path with trim, injectable for tests. Failure routed through COPY_BUTTON_FAILURE_MESSAGE constant (retail-safe: "Could not copy to clipboard. Check browser permissions or try again.") — no DOMException leak.
Unit tests 7/7 PASS (copyToClipboard 3 + CopyButton 4) at
854d0cd9.Docs anchor
#copy-button-primitiveresolves atdocs/frontend.md:121, cross-linked from AGENTS_FRONTEND_COPY_BUTTON.md and AGENTS_FRONTEND_WALLET_CHIP.md. Wallet dropdown consumer flow verified under #185.good to close.
mentioned in issue #541
mentioned in issue #665
marked as related to #665
mentioned in issue #671
marked as related to #671