From 23922f04011188af0e7422b888a05a82c730506e Mon Sep 17 00:00:00 2001 From: waterWang Date: Mon, 10 Aug 2026 09:48:00 +0800 Subject: [PATCH] a11y: add title attribute to TruncatedAddress copy button Adds the missing `title` attribute to the copy button inside TruncatedAddress.tsx so sighted mouse users see a tooltip on hover. The `aria-label` was already present; this fix completes the accessible name pair for both screen-reader and mouse users. Closes #868 --- __tests__/components/TruncatedAddress.test.tsx | 5 +++++ components/ui/TruncatedAddress.tsx | 1 + 2 files changed, 6 insertions(+) diff --git a/__tests__/components/TruncatedAddress.test.tsx b/__tests__/components/TruncatedAddress.test.tsx index 9cb112cd..6ca85d03 100644 --- a/__tests__/components/TruncatedAddress.test.tsx +++ b/__tests__/components/TruncatedAddress.test.tsx @@ -65,6 +65,11 @@ describe('TruncatedAddress', () => { }); expect(writeTextSpy).toHaveBeenCalledWith(ADDRESS); + expect( + screen.getByRole('button', { + name: 'Copy full address to clipboard', + }), + ).toHaveAttribute('title', 'Copy full address to clipboard'); }); it('auto-hides the tooltip after the timeout elapses', () => { diff --git a/components/ui/TruncatedAddress.tsx b/components/ui/TruncatedAddress.tsx index ae4e7ce5..8d5d45d9 100644 --- a/components/ui/TruncatedAddress.tsx +++ b/components/ui/TruncatedAddress.tsx @@ -165,6 +165,7 @@ export default function TruncatedAddress({ type="button" onClick={copy} aria-label="Copy full address to clipboard" + title="Copy full address to clipboard" className="shrink-0 flex items-center justify-center w-6 h-6 rounded hover:bg-gray-700 transition text-gray-400 hover:text-white pointer-events-auto" > {copied ? (