Skip to content

fix(Timestamp): a hover-card copy button shows and announces a failed copy - #10434

Merged
cixzhang merged 6 commits into
mainfrom
fix/timestamp-copy-failure
Nov 12, 2026
Merged

cixzhang merged 6 commits into
mainfrom
fix/timestamp-copy-failure

Conversation

@cixzhang

@cixzhang cixzhang commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #10448 (a failed copy is announced assertively); the base is that branch until it merges.

Who this helps

People who copy a value from a Timestamp's hover card. When the clipboard write fails (permission denied, an insecure context, no Clipboard API), the copy button used to do nothing, so they couldn't tell the value wasn't copied. Now it shows a cross for 1.5 seconds and screen readers hear "Failed to copy value to clipboard.", matching CodeBlock's copy button.

What changed

  • Button: TimestampHoverCard's copy button uses Core's internal useClipboardCopy, the hook CodeBlock's copy button uses. A rejected write:
    • shows the close icon for the same 1.5 s as the success check;
    • sets the button's name and tooltip to "Failed to copy value to clipboard." and announces it once on the assertive live region;
    • exposes no error detail.
  • Theme slot: the timestamp-copy slot's copied state is false during a failure, so a theme that maps the slot keeps its rest glyph then.
  • Locale: a new key, @astryx.timestamp.copyFailed.
  • Record: Timestamp FR8 used to say "A clipboard rejection does nothing"; it now states the failure treatment, credited "(Owner decision, Nov 6 2026 (Cindy))". FR10 and the doc's slot fallback add close.
  • Tests: a rejected write sets the failure name and tooltip and announces it assertively, then returns to rest. The slot suite draws close on a failure with no theme entry, and passes copied: false to a slot function when a failure follows a success. The verification rows name these cases.

Verification

  • Red first: the new test fails on main's hover card and passes here.
  • Suites: the Timestamp and useClipboard suites pass (263).
  • Other checks: lint, typecheck, check:changesets and check-knowledge pass.

Changeset: [fix] patch for Core.

Writing rubric results

Covers component:Timestamp (FR8, FR10).

R1 narration: none; the rows say what the button does.
R2 research: none.
R3 evidence: no evidence cell names a pull request.
R4 rejected alternatives: none.
R5 change references: none.
R6 open questions: none.

… copy

The copy button uses the internal useClipboardCopy, as CodeBlock does: a
rejected write shows `close` for the same 1.5 s, names and tooltips the
button "Failed to copy value to clipboard." and announces it once, with no
error detail. `copied` stays false during a failure, so a theme-mapped
`timestamp-copy` slot keeps its rest glyph. It used to do nothing.
@vercel

vercel Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 12, 2026 7:11am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 7, 2026
@astracat-bot

astracat-bot Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 12, 2026, 7:29 AM UTC

@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 7, 2026
@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · ebd515a

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
lab/Comments 358.6 kB (+8 B) · 2.5 kB CSS (0) — — · — · —
lab/CommentThread 351.9 kB (+6 B) · 2.4 kB CSS (0) — — · — · —
Timestamp · Storybook 34.8 kB (0) · 10.3 kB CSS (0) 927 (+13) ✓ · ✓ · —

Package size: @astryxdesign/core 7.35 MB packed (+94 B); no new dependencies.

Touched components checked; add ci:run-visual, ci:run-a11y or ci:run-rtl to run the full suites.


Generated by PR Enrichment workflow | View full report

@cixzhang

cixzhang commented Nov 7, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec 60f6d1e

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 7, 2026

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Requesting changes: the failure feedback works and the FR8/FR10 spec change is approved for this head, but the new failure state is not yet covered by tests or by the record's verification map.

Required:

  • Add copy-icon-slot tests that reject the clipboard write and assert the close fallback glyph, plus a slot function that receives {copied: false} when a failure follows a success within 1.5 s, then update the FR7/FR8/AR4 and FR10 verification rows, which still cite "the clipboard-rejection no-op" and name no failure case.
  • Miss: assert the failure tooltip "Failed to copy value to clipboard." in the new failed-copy test, since a version that keeps the "Copy" tooltip during a failure passes every Timestamp test.

Optional: two new comments in TimestampHoverCard.tsx restate the code; see the earlier inline notes.

[Automated review]

The internal useClipboardCopy announced a failed write on the polite live
region. Status announcements put errors outside a live container on the
assertive channel, so the failure now goes there. CodeBlock is the one
shipped caller; its record (AR3) says so. Success stays polite.
The slot suite rejects a write and expects `close` with no theme entry,
and passes `copied: false` to a slot function when a failure follows a
success. The failed-copy test checks the tooltip and the assertive
announcement. The verification rows name these cases, and two comments
that restated the code are shortened.
@cixzhang
cixzhang changed the base branch from main to fix/copy-failure-assertive November 7, 2026 04:12
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 7, 2026
@cixzhang

cixzhang commented Nov 7, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec 8d9c19a

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 7, 2026

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved pending CI: CI has not run on this head yet, because the pull request is a draft based on #10448's branch rather than main.

The earlier blocking findings are fixed. The close glyph, the failure tooltip and the slot's copied: false state now each have a test that fails when they break, and the verification map names those cases. The FR8/FR10 change is approved for this head, and the assertive failure announcement follows spec:AST-086 FR5.

Next: this lands after #10448. Once it is retargeted to main and marked ready, CI runs on it.

  • Non-blocking: the FR7, FR8, AR4 verification row in Timestamp.spec.md now ends in a stray semicolon.

[Automated review]

@github-actions
github-actions Bot deleted the branch fix/copy-failure-assertive November 10, 2026 06:04
Timestamp.spec.md takes main's verification map, with the failed-copy test added to the FR7, FR8, AR4 row; Timestamp.doc.mjs takes main's quoting with the failed-copy fallback. Drops the assertive-failure changeset, which shipped with #10448.
@cixzhang
cixzhang marked this pull request as ready for review November 12, 2026 00:44
@cixzhang
cixzhang changed the base branch from fix/copy-failure-assertive to main November 12, 2026 00:48
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 12, 2026
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec cdd7f58

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 12, 2026
@cixzhang cixzhang added the ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) label Nov 12, 2026

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Requesting changes: the failed-copy feedback and the FR8/FR10 rewrite look right, but merging main brought back the record's old verification rows for the copy button.

  • docs/specs/components/Timestamp/Timestamp.spec.md lines 255 and 257: the FR7, FR8, AR4 row again says useClipboard.test.tsx covers "the clipboard-rejection no-op" and its states and expectation drop the failed copy, and the FR10 row lists no failure state, so both contradict the rewritten FR8/FR10; please restore the cells from the previous commit, ending the Gap sentence with a period.

The FR8/FR10 change is approved for this head, and the code and the three new tests match it. CI's build and test jobs are deferred until the pull request is ready for heavy CI.

  • Non-blocking: FR10's null-slot sentence (line 128) could also say no glyph shows while a failed copy shows.
Claims and files checked

Claims:

  • The hover card's copy button used to do nothing on a failed write: verified (the base used the public hook, which drops the failure state).
  • A failed write now shows a cross for 1.5 seconds, sets the name and tooltip to the failure text and announces it once on the assertive region: verified (TimestampHoverCard.tsx:145-187, hooks/useClipboard.ts:156-170, Timestamp.test.tsx:1207, :1308).
  • No error detail is exposed: verified (no error handler is passed, TimestampHoverCard.tsx:149-153).
  • The slot's copied state is false during a failure, so a mapped glyph stays at rest: verified (TimestampHoverCard.tsx:166, Timestamp.test.tsx:1322).
  • A new catalog key supplies the failure text: verified (en.json:1914-1917).
  • FR8, FR10 and the doc's slot fallback describe the failure treatment: verified (Timestamp.spec.md:126, :128, Timestamp.doc.mjs:124-131).
  • The verification rows name the new cases: false; the FR10 row's states and expectation omit them and the FR8 row still calls a rejection a no-op (Timestamp.spec.md:255, :257).
  • The new test fails on the base and the Timestamp and clipboard suites pass: not verified (the tests could not run in this review, and CI's test job is deferred).
  • Lint and typecheck pass: verified by CI at this head; the changeset and knowledge checks: not verified.
  • The changeset is a patch for Core describing this fix: verified.
  • The change it was stacked on (assertive failure announcements) is merged: verified.

Files:

  • .changeset/timestamp-copy-failure.md: clear.
  • docs/specs/components/Timestamp/Timestamp.spec.md: verification rows at lines 255 and 257 (blocking); FR10 null-slot wording (non-blocking).
  • packages/core/locales/en.json: clear.
  • packages/core/src/Timestamp/Timestamp.doc.mjs: clear.
  • packages/core/src/Timestamp/Timestamp.test.tsx: clear.
  • packages/core/src/Timestamp/TimestampHoverCard.tsx: clear.

Automated review (maintainer link)

@cixzhang
cixzhang marked this pull request as draft November 12, 2026 07:03
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 12, 2026
@cixzhang
cixzhang marked this pull request as ready for review November 12, 2026 07:03
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec ebd515a

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 12, 2026

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved. The failed-copy feedback matches the FR8/FR10 rewrite that an engineering owner approved for this head, and the verification rows that the merge of main had reverted are restored. No blocking findings remain.

Claims and files checked
  • Changeset: a failed write shows a cross for 1.5 seconds, as CodeBlock's copy button does — verified in the copy button and its slot test.
  • Changeset: the button is named, tooltipped and announces "Failed to copy value to clipboard." — verified by the new hover-card test and in Storybook.
  • Changeset: it used to do nothing — verified: the base used the public clipboard hook, which drops a rejected write.
  • Changeset: a theme that maps the timestamp-copy slot keeps its rest glyph during a failure — verified by the slot-function test.
  • Changeset: the error itself is not shown — verified: no error handler is passed and the text is fixed.
  • Description: the change was stacked on the assertive-announcement fix until it merged — verified: that fix is on main and this pull request targets main.
  • Description: the button uses the internal hook CodeBlock's copy button uses — verified.
  • Description: the cross lasts the same 1.5 seconds as the success check — verified: one duration drives both timers.
  • Description: name and tooltip change, one assertive announcement, no error detail — verified.
  • Description: the slot's copied state is false during a failure — verified.
  • Description: a new locale key carries the text — verified.
  • Description: FR8 and FR10 and the doc's slot fallback describe the failure — verified.
  • Description: the tests and verification rows name the failure cases — verified.
  • Description: the new test fails on main — verified by reading: main renders no failure text.
  • Description: the Timestamp and clipboard suites pass — the Timestamp suites pass in CI on this head and every CI test job passed; the exact total was not reproduced.
  • Description: lint, typecheck and the changeset and knowledge checks pass — verified in CI on this head.
  • Description: a patch changeset for Core — verified.
  • Files: .changeset/timestamp-copy-failure.md, docs/specs/components/Timestamp/Timestamp.spec.md, packages/core/locales/en.json, packages/core/src/Timestamp/Timestamp.doc.mjs, packages/core/src/Timestamp/Timestamp.test.tsx, packages/core/src/Timestamp/TimestampHoverCard.tsx — each clear.

Automated review (maintainer link)

@cixzhang
cixzhang merged commit edb2de9 into main Nov 12, 2026
93 of 134 checks passed
@cixzhang
cixzhang deleted the fix/timestamp-copy-failure branch November 12, 2026 07:45

This branch was successfully deployed

1 active deployment
Preview — ebd515a6 Deployed Nov 12, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant