Repository navigation
fix(Timestamp): a hover-card copy button shows and announces a failed copy - #10434
Conversation
… 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.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
| 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
|
/approve-spec 60f6d1e |
There was a problem hiding this comment.
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
closefallback 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.
|
/approve-spec 8d9c19a |
There was a problem hiding this comment.
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.mdnow ends in a stray semicolon.
[Automated review]
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.
|
/approve-spec cdd7f58 |
There was a problem hiding this comment.
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.mdlines 255 and 257: the FR7, FR8, AR4 row again saysuseClipboard.test.tsxcovers "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
copiedstate 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.
|
/approve-spec ebd515a |
There was a problem hiding this comment.
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-copyslot 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
mainand this pull request targetsmain. - 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
copiedstate 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:mainrenders 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.
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
TimestampHoverCard's copy button uses Core's internaluseClipboardCopy, the hook CodeBlock's copy button uses. A rejected write:closeicon for the same 1.5 s as the success check;timestamp-copyslot'scopiedstate is false during a failure, so a theme that maps the slot keeps its rest glyph then.@astryx.timestamp.copyFailed.close.closeon a failure with no theme entry, and passescopied: falseto a slot function when a failure follows a success. The verification rows name these cases.Verification
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.