Repository navigation
fix(useClipboard): a failed copy is announced assertively - #10448
Conversation
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 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 |
|---|---|---|---|
| CodeBlock · Storybook | 71.0 kB (+8 B) · 11.1 kB CSS (0) | 2,244 (0) | ✗ · ✓ · ✓ |
| Markdown | 163.8 kB (+9 B) · 19.8 kB CSS (0) | — | — · — · — |
| Timestamp | 23.3 kB (0) · 10.1 kB CSS (0) | — | — · — · — |
4 more components
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| lab/Comments | 308.8 kB (new) · 2.5 kB CSS (new) | — | — · — · — |
| lab/CommentThread | 303.5 kB (new) · 2.4 kB CSS (new) | — | — · — · — |
| richtext/RichTextEditor | 292.4 kB (new) · 2.6 kB CSS (new) | — | — · — · — |
| richtext/RichTextView | 272.0 kB (new) · 2.3 kB CSS (new) | — | — · — · — |
Visual changes: 1 snapshot in 1 component
A change is a question for the reviewer, not a failure.
| Component · story | Before | After | Diff |
|---|---|---|---|
| CodeBlock · Default (neutral, dark) | ![]() |
![]() |
![]() |
Package size: measured; main has no measurement of the merge base to compare yet.
API changes: cli +14 · ~5 · −0 (against the merge base's committed report)
Committed API report behind this build: cli 19 rows, core 24 rows; run pnpm api:report.
19 API changes (advisory)
| Package | Where | Signature | Usage | |
|---|---|---|---|---|
| + | cli |
./api · Types · type SearchResultEntry |
deprecated?: ComponentDeprecation | undefined |
import type {SearchResultEntry} from '@astryxdesign/cli/api'; const x: SearchResultEntry = {deprecated: …} |
| + | cli |
./authoring · Types · interface ComponentDeprecation |
interface ComponentDeprecation |
import type {ComponentDeprecation} from '@astryxdesign/cli/authoring' |
| + | cli |
./authoring · Types · interface ComponentIconSlotDoc |
interface ComponentIconSlotDoc |
import type {ComponentIconSlotDoc} from '@astryxdesign/cli/authoring' |
| + | cli |
./authoring · Types · interface ComponentIconSlotStateDoc |
interface ComponentIconSlotStateDoc |
import type {ComponentIconSlotStateDoc} from '@astryxdesign/cli/authoring' |
| + | cli |
./authoring · Types · interface MultiComponentDoc |
deprecated?: ComponentDeprecation |
import type {MultiComponentDoc} from '@astryxdesign/cli/authoring'; const x: MultiComponentDoc = {deprecated: …} |
| + | cli |
./authoring · Types · interface SingleComponentDoc |
deprecated?: ComponentDeprecation |
import type {SingleComponentDoc} from '@astryxdesign/cli/authoring'; const x: SingleComponentDoc = {deprecated: …} |
| + | cli |
./doc · Types · interface ComponentBaseDoc |
deprecated?: ComponentDeprecation |
import type {ComponentBaseDoc} from '@astryxdesign/cli/doc'; const x: ComponentBaseDoc = {deprecated: …} |
| + | cli |
./doc · Types · interface SubComponentDoc |
deprecated?: ComponentDeprecation |
import type {SubComponentDoc} from '@astryxdesign/cli/doc'; const x: SubComponentDoc = {deprecated: …} |
| + | cli |
./doc · Also exported from an earlier entry point · ComponentDeprecation |
ComponentDeprecation (./authoring) |
import {ComponentDeprecation} from '@astryxdesign/cli/doc' |
| + | cli |
./doc · Also exported from an earlier entry point · ComponentIconSlotDoc |
ComponentIconSlotDoc (./authoring) |
import {ComponentIconSlotDoc} from '@astryxdesign/cli/doc' |
| + | cli |
./doc · Also exported from an earlier entry point · ComponentIconSlotStateDoc |
ComponentIconSlotStateDoc (./authoring) |
import {ComponentIconSlotStateDoc} from '@astryxdesign/cli/doc' |
| + | cli |
./template · Also exported from an earlier entry point · ComponentDeprecation |
ComponentDeprecation (./authoring) |
import {ComponentDeprecation} from '@astryxdesign/cli/template' |
| + | cli |
./template · Also exported from an earlier entry point · ComponentIconSlotDoc |
ComponentIconSlotDoc (./authoring) |
import {ComponentIconSlotDoc} from '@astryxdesign/cli/template' |
| + | cli |
./template · Also exported from an earlier entry point · ComponentIconSlotStateDoc |
ComponentIconSlotStateDoc (./authoring) |
import {ComponentIconSlotStateDoc} from '@astryxdesign/cli/template' |
| ~ | cli |
./api · Functions · function search |
function search: (query: string, options?: { cwd?: string | undefined; type?: "template" | "component" | "hook" | "theme" | "doc" | undefined; limit?: number | undefined }) => Promise<SearchResponse> → function search: (query: string, options?: { cwd?: string | undefined; type?: "template" | "component" | "doc" | "theme" | "hook" | undefined; limit?: number | undefined }) => Promise<SearchResponse> |
import {search} from '@astryxdesign/cli/api'; search(…) |
| ~ | cli |
./authoring · Types · interface MultiComponentDoc |
theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[] } → theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[]; componentIcons?: ComponentIconSlotDoc[] } |
import type {MultiComponentDoc} from '@astryxdesign/cli/authoring'; const x: MultiComponentDoc = {theming: …} |
| ~ | cli |
./authoring · Types · interface SingleComponentDoc |
theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[] } → theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[]; componentIcons?: ComponentIconSlotDoc[] } |
import type {SingleComponentDoc} from '@astryxdesign/cli/authoring'; const x: SingleComponentDoc = {theming: …} |
| ~ | cli |
./doc · Types · interface ComponentBaseDoc |
theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[] } → theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[]; componentIcons?: ComponentIconSlotDoc[] } |
import type {ComponentBaseDoc} from '@astryxdesign/cli/doc'; const x: ComponentBaseDoc = {theming: …} |
| ~ | cli |
./doc · Types · interface SubComponentDoc |
theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[] } → theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[]; componentIcons?: ComponentIconSlotDoc[] } |
import type {SubComponentDoc} from '@astryxdesign/cli/doc'; const x: SubComponentDoc = {theming: …} |
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
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, and it runs once the pull request is marked ready for review.
Sending a failed CodeBlock copy to the assertive channel matches spec:AST-086 FR5 (errors use the assertive channel), and the updated CodeBlock AR3 clause restates that rule for the copy button. Both changed tests fail with the previous hook and pass with this change. The repository's spec gate still needs an engineering owner to comment /approve-spec for this head, because the change edits the CodeBlock record.
[Automated review]
|
/approve-spec 016ccf1 |
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.
…ed copy through public hooks Comments takes useClipboard's false result and holds its own two-second failed state, announced assertively through useAnnounce, so no new Core entry is needed: the internal/clipboard-copy entry, its test, and its export wiring are removed. Drops the assertive-failure changeset, which shipped with #10448, and the changeset names the Lab fix.
… copy (#10434) * fix(Timestamp): a hover-card copy button shows and announces a failed 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. * fix(useClipboard): a failed copy is announced assertively 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. * Merge branch fix/copy-failure-assertive * test(Timestamp): cover the failure glyph, slot state and tooltip 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. * Merge main into fix/timestamp-copy-failure 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. * docs(spec): Timestamp verification rows keep the failed-copy states after the merge
…10435) * fix(Comments): a failed comment-link copy shows and announces itself Copy comment link uses Core's useClipboardCopy, the hook CodeBlock's copy button uses, through a new internal entry (`@astryxdesign/core/internal/clipboard-copy`, not public API). A rejected write shows a cross for two seconds, names and tooltips the button "Failed to copy value to clipboard." and announces it once. It used to do nothing. * fix(useClipboard): a failed copy is announced assertively 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. * Merge branch fix/copy-failure-assertive * test(Comments): a failed link copy is announced assertively The failure test reads the assertive region, now that the shared hook announces failures there. The internal entry's header names its one caller, and a comment that restated the icon ternary is gone. * Merge main into fix/comments-copy-link-failure; Comments reads a failed copy through public hooks Comments takes useClipboard's false result and holds its own two-second failed state, announced assertively through useAnnounce, so no new Core entry is needed: the internal/clipboard-copy entry, its test, and its export wiring are removed. Drops the assertive-failure changeset, which shipped with #10448, and the changeset names the Lab fix. * chore(changeset): name only Core, the published package the Comments fix touches * fix(Comments): unmounting a comment stops its failed-copy reset The failed-copy reset timer is cleared on unmount (architecture:react-component-runtime INV5). A unit case unmounts a comment while its failure shows and checks that the reset is stopped. * Merge main into fix/comments-copy-link-failure; Comments is Lab-only Main now carries @astryx.comments.linkCopyFailed (#11376), so this branch's identical catalog hunk drops out and its Core changeset goes. A comment in CommentActions says why the failed state lives in Lab (architecture:knowledge-contracts DEC-19). * fix(lab): Comments copy-link comments state the reason; an in-flight write sets no state after unmount The failed-copy comment drops its record citation and keeps only the reason; the tooltip comment covers a failed copy too. A clipboard write still in flight when the comment unmounts now sets no state. * Merge main into fix/comments-copy-link-failure * fix(lab): Comments reaches Core's shared failed-copy state Comments kept its own copy of the failed-write state that Core's useClipboardCopy owns for CodeBlock and Timestamp. Core now exposes the hook to Lab as the internal entry @astryxdesign/core/internal/clipboard-copy (Core and Lab only, by lint), and Comments calls it once. The in-flight guard moves into the hook: a write that settles after its caller unmounts sets no state, starts no timer and announces nothing, for every caller. data-link-copied no longer reads "copied" while a failure shows. react-component-runtime names the entry. * chore(core): a changeset for the clipboard hook's unmount guard The guard ships in Core, so CodeBlock and Timestamp get a patch [fix] entry. Drops a comment that restated the hook.
…10424) * fix(Markdown): a heading copy link shows and announces a failed copy The heading copy-link button now uses the internal useClipboardCopy, as CodeBlock does: a rejected write swaps `#` for a cross for 1.5 s, names the button and announces "Failed to copy value to clipboard." once, and exposes no error detail. It used to fail silently. The headingLinks record FR10 and the copy contract say so (owner decision, Nov 6 2026). * fix(Markdown): builder docs describe the failed copy; test counts its announcement The Markdown doc guidance no longer says failures stay silent, and the rejection test checks the failure is announced exactly once. * fix(useClipboard): a failed copy is announced assertively 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. * Merge branch fix/copy-failure-assertive * test(Markdown): count each announcement write; the failure is assertive The rejection test records one entry per write that adds text to a live region and runs one more frame after the reset, so a repeat while the cross shows or on reset fails it. With the shared hook announcing failures assertively, it expects one assertive announcement. The record's reveal sentence and design row name the cross. * Merge main into fix/heading-links-copy-failure * chore: drop the assertive-failure changeset, which shipped with #10448 * test(Markdown): the unavailable-Clipboard case checks the cross, the announcement and the reset The case now checks what the description says: the cross replaces the hash, the failure goes to the assertive live region, and the button returns to rest. The catalog description says the failure is announced once, assertively. * chore(changeset): the heading-link copy failure is a feature (AST-017 FR5) * test(Markdown): a failed heading-link copy draws the close glyph * Merge branch 'main' into fix/heading-links-copy-failure * Merge branch 'main' into fix/heading-links-copy-failure * Merge main into fix/heading-links-copy-failure



Who this helps
Screen-reader users who copy from a CodeBlock. When the copy fails, "Failed to copy value to clipboard." used to wait in the polite queue behind other speech. Status announcements put errors outside a live container on the assertive channel, so a failed copy is now announced right away. A successful copy is still announced politely.
What changed
useClipboardCopyannouncesannounceFailurewith'assertive'(spec:AST-086FR5). It's the shared failure path for every copy button that reports a failure. CodeBlock is the one shipped caller; the Markdown heading-link, Timestamp and lab Comments follow-ups use it too.useClipboard.test.tsx: a failed write writes to the assertive region and not the polite one.CodeBlock.test.tsx: the failed-write test reads the assertive region and checks the polite one stays free of the failure.Verification
Changeset:
[fix]patch for Core.Writing rubric results
Covers
component:CodeBlockAR3.R1 narration: none; the line says what the control emits and why.
R2 research: none.
R3 evidence: no evidence cell names a pull request.
R4 rejected alternatives: none.
R5 change references: none.
R6 open questions: none.