Repository navigation
fix(Toast): the viewport is each toast's only announcement owner - #7871
Conversation
|
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 |
|---|---|---|---|
| FieldStatus · Storybook | 9.8 kB (0) · 3.6 kB CSS (0) | 164 (0) | ✓ · ✓ · — |
| Toast · Storybook | 98.3 kB (0) · 10.3 kB CSS (0) | 1,654 (+10) | ✓ · ✓ · ✓ |
Package size: @astryxdesign/core 7.18 MB packed (+325 B); no new dependencies.
API changes: none in this pull request
Committed API report behind this build: cli 29 rows, core 34 rows, theme-butter 1 row, theme-y2k 1 row; run pnpm api:report.
Touched components checked; add ci:run-visual or ci:run-rtl to run the full suites.
Generated by PR Enrichment workflow | View full report
There was a problem hiding this comment.
Changes requested: the single-owner model matches spec:AST-086, and the accessibility tree shows one exposed live region per toast, inside the Dialog when one is open, but two required checks fail on this head.
- The four Toast bindings in
packages/core/src/FieldStatus/__tests__/StatusMessage.a11y.states.tsstill expect a live toast card and a single channel subject, while the in-place viewport's always-mounted empty pair now adds a secondstatus/alertsubject, so those bindings need to move to the one-owner model. - CI's strict lint rejects
ownRegionTimersatpackages/core/src/Toast/ToastViewport.tsx:425under@eslint-react/naming-convention-ref-name; renaming itownRegionTimersRefclears the job.
[Automated review]
There was a problem hiding this comment.
Approval waits on a maintainer: the one-owner model for the toast card and the top-layer viewport matches spec:AST-086, and the accessibility tree shows one exposed live region per toast, inside the Dialog when one is open. No current spec covers the in-place viewport (isTopLayer={false}) announcing through its own regions inside an open modal, because AST-086 FR10 covers only owners spec:AST-003 rehosts and its Platform support leaves other in-modal delivery outside the record, so a maintainer needs to provide or identify the governing spec for that branch. Separately, spec:AST-009 FR17 needs the real-AT matrix (at least NVDA + Chrome and VoiceOver + Safari) and the Toast scenarios named here, plus a release-block record, before merge, since the changeset promises that screen readers hear each toast once. The red pr-a11y check comes from main's workflow running a spec file this branch predates, so updating the branch clears it.
[Automated review]
## Exact decision needed
Whether merge or stable release may wait on real assistive-technology (NVDA, VoiceOver) evidence that contributors cannot produce.
## Existing authority searched
- `spec:AST-009` (current): FR4/FR8/FR17–FR19 required an explicit trigger classification, a named real-AT matrix, a scenario, and a durable release-block record, and blocked the first stable release until real-AT receipts passed or an owner exception applied.
- Linked records that restated the block or required screen-reader checks: `spec:AST-001` (browser evidence and FR7 row), `module:Table/useTableRowStatus` AR6, `module:Table/useTableColumnResize` verification, `spec:AST-056` (browser evidence line), `spec:AST-021` (release boundary phrase), `spec:AST-086` (FR6 real-AT row and platform line), `component:FieldStatus` AR5 and its verification row, `spec:AST-020` FR6 ("real-AT contract").
- Open PRs that add release-block sections to AST-009: #7732, #7275, #7272. Under this record those sections are no longer needed.
## Decision
- No requirement gates merge or release on evidence that cannot be produced (Intent, FR17, DEC-4).
- Merge and stable release need only the unit, DOM, accessibility-tree, axe, and real-browser evidence the owning records require (FR17).
- Announcements are proved by their routing: which element or channel carries them, their text, urgency, and update count per occasion (FR4, FR19).
- Real-AT observation is recommended follow-up when an outcome depends on AT behavior, may be tracked in a public issue, and holds no pull request or release (FR1–FR6, FR18).
- A change with an AT-dependent claim says so and names its lower-layer evidence; no matrix, scenario, or release record is needed to merge (FR8).
- Evidence-layer boundaries, the representative matrix, failure handling, and durable receipts stay, scoped to when a real-AT check runs.
- The exception process (old FR23–FR26) is removed because nothing remains to except.
## Rejected alternatives
- Holding stable releases until named real-AT receipts pass: fixes for known accessibility defects stall when no contributor can run the required pairings.
## Claim scope and non-goals
Only the evidence bar for merge and release, and the status of real-AT observation. Component accessibility requirements, evidence-layer boundaries, and focus/announcement behavior stay with their owners.
## Evidence and implementation relationship
Status-announcement conformance PRs (#7869, #7870, #7871, #7892, #7900, #7910) stall on the old real-AT release-block requirement because nobody in the review loop can run NVDA or VoiceOver. No implementation is included.
## Writing rubric results
- R1 narration: none; present-tense rules throughout. The two earlier holds are described as current follow-ups.
- R2 research in the record: none.
- R3 evidence naming a change: none; the earlier hold sections that named pull requests are replaced by the facts (story names and claims).
- R4 rejected alternatives over one line or outside a decision: one per decision, one line each.
- R5 pull request or issue references remaining: none in AST-009 or the edited lines.
- R6 ruled open questions still listing options: none.
## Scope
- [x] This PR contains specification records only.
- [x] It records observable behavior and preserves equivalent internal implementations.
- [x] Any named internal mechanism is intentionally public, names its dependent caller/system, and explains why an equivalent implementation would not satisfy the contract.
- [x] Verification states the evidence layer and failure signal without prescribing CI job/workflow topology.
- [x] It records one intentional durable decision, not a rescue for a separable tagalong.
- [x] The canonical knowledge owner, affected current claims, and overlapping open work are named; any ownership collision is resolved or called out for human decision.
- [x] Adjacent API, visual, accessibility, composition, and implementation facts remain outside scope unless this exact decision depends on them.
- [x] Public text and artifacts contain no internal Meta context.
## Validation
- `pnpm check:knowledge`
- Prettier
- `git diff --check`
There was a problem hiding this comment.
Approval waits on a maintainer: the one-owner model for the toast card and the top-layer viewport matches spec:AST-086, and Chromium's accessibility tree shows one exposed live region per toast, inside the Dialog when one is open. No current spec covers an in-place viewport (isTopLayer={false}) announcing through its own regions inside an open modal, because AST-086 FR10 covers only owners spec:AST-003 rehosts and its Platform support leaves other in-modal delivery outside the record, so a maintainer needs to provide or identify the governing spec for that branch. Separately, the Toast status-message binding still renders only an in-place viewport outside a modal (StatusMessage.a11y.renders.tsx), so please add top-layer states so the shared contract runs against the regions every app now uses, as spec:AST-021 FR4 requires. The earlier request for an AST-009 real-AT matrix no longer applies, since AST-009 FR17 now keeps real-AT evidence out of the merge bar.
[Automated review]
|
The change itself looks right: the card drops What the diff removes
What the diff adds
The gap
"bound above" is the part I cannot verify. The binding that remains renders only Two ways this could be closed, and I do not know which is intended
Why I am asking rather than assuming The observable behaviour differs: with the shared channel, a toast outside a modal is announced by the body-level region; with own containers, it is announced by a region that moves with the viewport. Both satisfy "announced once". Only one of them satisfies "the viewport is the only owner" as a statement about which channel, and the exclusion is written as if that distinction is load-bearing. Happy to be wrong on either reading - I could not find a binding state that covers the non-modal viewport after this diff, and maybe that configuration is meant to be dead code. |
…oined (#9070) ## Exact decision needed Whether `spec:AST-086` FR9's shared channel joins a component's superseded message about its current state with its next one, and the optional public `useAnnounce` option that asks for replacement. Today every message written to a region before the previous one is exposed is joined, so a component that states its current state on every input, such as a search's result count, has all its stale states spoken together when input outpaces a frame (a barcode scanner, dictation, automation): `1 result Create "Urg" Create "Urge" Create "Urgen" Create "Urgent"`. ## Existing authority searched - `spec:AST-086` FR9 (the join), FR6 (an identical message repeated in a frame is one message), FR8 (a busy start its outcome overtakes is dropped), FR13 and FR14 (own-content messages and modal containers). - `architecture:interaction-modality` INV8: superseded work must not change the current status or announcement, with supersession left to component contracts. - `spec:AST-075` DEC-2 and FR7: Astryx's comboboxes announce their result count with `useAnnounce`, the same hook products use. Tokenizer's record: its sheet's count and empty-state text go through `useAnnounce`. MultiSelector's record (draft): its result count and create row label go through the polite channel. - `spec:AST-002` FR1, FR2, FR5, FR7, FR16 and FR20 for the new public option; `has*` booleans such as `hasClear` and `hasPaging` for its name. - Open pull requests that mention AST-086 (#7871, #7902, #7910, #8175, #8211, #8583, #8001): none edits FR9. #8640 implements the replacement for MultiSelector and waits for this decision. ## Decision A `useAnnounce` instance created with `hasReplace` states one current state of its owner, such as a search's result count: each message it writes withdraws that instance's previous message while it is not yet exposed, whatever their urgencies, and is spoken in the region of its own urgency; a message already exposed has been heard and stays. Messages from other instances, and from instances without `hasReplace`, still join. `useAnnounce` takes an optional options object with one field, `hasReplace` (default `false`), and the `announce(message, politeness)` it returns is unchanged. FR14's modal containers withdraw the same way, and a picker's own empty-panel message comes from its search's `hasReplace` instance (FR13). Astryx's search counts and MultiSelector's create row use a separate `useAnnounce({hasReplace: true})` instance (`spec:AST-075` FR7, Tokenizer's and MultiSelector's records); selection messages keep their own plain instance. DEC-4 records it; its decider is the approving engineering owner, with INV8 and FR8 as its reasons. Public option (`spec:AST-002` FR5, FR20): two otherwise identical messages, `"7 results"` written twice in one frame, need different outcomes. As a search's count it replaces the earlier one; as two distinct notices both are spoken. Only the caller knows which it sends, and the channel cannot derive it. Before: `const announce = useAnnounce(); announce(t('resultCount', {count}));`. After: `const announceCount = useAnnounce({hasReplace: true}); announceCount(t('resultCount', {count}));`. Existing calls are unchanged. ## Rejected alternatives - Each owner debouncing its own messages: every announcement waits, and every owner repeats the rule. - An exception for every `useAnnounce` message: Astryx's comboboxes and Tokenizer announce through `useAnnounce`, so their counts would keep joining. - A string key on each message (`announce(message, politeness, {currentState})`): a third argument whose strings every call must keep consistent, where one instance already states one state. ## Claim scope and non-goals FR9's replacement within one `hasReplace` instance, the option that asks for it, and the AST-075, Tokenizer and MultiSelector sentences that describe their counts' announcement. Which messages a component sends through a `hasReplace` instance stays with its own record. ## Evidence and implementation relationship - On main, the MultiSelector CreateRow accessibility spec, which types into the create row at about four keystrokes per frame, fails 9 of 10 runs alone and 26 of 48 under load, its polite region reading the joined statuses. - #8640 implements the replacement for MultiSelector. With it, the spec passes 10 of 10 alone and 48 of 48 under load. It lands after this record changes, adopting `useAnnounce({hasReplace: true})`. ## Writing rubric results - R1 narration: none, in AST-086, AST-075, Tokenizer's or MultiSelector's record. - R2 research in the record: none. - R3 evidence naming a change: none. - R4 rejected alternatives over one line or outside a decision: one, inside DEC-4, one line; nothing added to the other records. - R5 pull request or issue references remaining: none. - R6 ruled open questions still listing options: none. ## Scope - [x] This PR contains specification records only. - [x] It records observable behavior and preserves equivalent internal implementations. - [x] Any named internal mechanism is intentionally public, names its dependent caller/system, and explains why an equivalent implementation would not satisfy the contract. - [x] Verification states the evidence layer and failure signal without prescribing CI job/workflow topology. - [x] It records one intentional durable decision, not a rescue for a separable tagalong. - [x] The canonical knowledge owner, affected current claims, and overlapping open work are named; any ownership collision is resolved or called out for human decision. - [x] Adjacent API, visual, accessibility, composition, and implementation facts remain outside scope unless this exact decision depends on them. - [x] Public text and artifacts contain no internal Meta context. ## Validation Local gates at 2b84901: `pnpm check:knowledge` (records and templates aligned), Prettier, `git diff --check`, `pnpm check:repo`.
A top-layer viewport, which the layer runtime rehosts above open modals, announces each toast through its own persistent polite and assertive regions, which move with it (spec:AST-086 FR10). A viewport rendered in place announces through useAnnounce, which delivers through an enclosing Astryx modal's containers (FR14). The card never carries a live role (FR1), so a toast over a modal is announced once. Adds the top-layer announcement binding states, and the Toast and AST-086 records drop the closed gap.
361362b to
7c9325b
Compare
|
/approve-spec c6be1e2 |
There was a problem hiding this comment.
Changes requested: making the viewport each toast's only announcement owner fixes toasts raised over an open Dialog, and the record edits are approved for this head, but the viewport's own regions lose a toast and three of the new or rewritten tests fail.
- Miss: two toasts of the same type raised in one handler announce only the second, because
announcecancels the first one's pending write (ToastViewport.tsx:458-471), whilespec:AST-086FR10 applies FR6 (once per occasion) to these regions and the base joins both. - Newly live check:
ToastViewport.tsx:436-471copies the region writer thatuseAnnounce.tsalready owns (writeModalRegionandannounceMessage) without its joining, so please extract that writer to take a target element and call it from the viewport instead. toast-info-announcement-top-layerandtoast-error-announcement-top-layertime out inStatusMessage.a11y.test.tsxbecauseToastTopLayerAnnouncementHarnessrenders nodata-a11y-ready="true"marker.ToastViewport.modalHost.test.tsx:284-286fails because each card's dismiss Button keeps its persistent loading region, which AST-086 FR3 and FR4 allow, so please assert only on live elements that hold the toast's words.- Regression: the description says every toast is heard twice, but the base already keeps the card silent outside a modal, and it lists changes this head does not make (
Toast.tsxedits, own regions for an in-place viewport, dropped card states, extra tests), so please update it to match this head. - Miss: the new cleanup Effect at
ToastViewport.tsx:439-447names no external system (architecture:react-component-runtimeINV3) and keeps its timers running after the regions unmount, which goes away once the shared writer owns them.
Separately, Toast.spec.md still counts sixteen implementation gaps where fifteen remain.
[Automated review]
…al case checks the card and its text, not the dismiss button's own region
There was a problem hiding this comment.
Changes requested: the test fixes land and the record edits are approved for this head, but the viewport's own regions still lose a toast, and two related problems remain.
- Miss: two toasts of the same type raised in one handler announce only the second, because
announcecancels the first one's pending write (ToastViewport.tsx:458-471), whilecomponent:ToastFR9 announces each shown toast once and the base joins both. - Newly live check:
ToastViewport.tsx:436-471copies the region writer thatuseAnnounce.tsalready owns (writeModalRegionandannounceMessage) without its joining, so please extract that writer to take a target element and call it from the viewport instead. - Miss: the new cleanup Effect at
ToastViewport.tsx:439-447names no external system (architecture:react-component-runtimeINV3) and leaves its frame and timer running after the regions unmount whenisTopLayerturns off (INV5), which goes away once the shared writer owns them.
The top-layer binding states and the modal-host test now pass, and the description matches the change. Separately, Toast.spec.md still counts sixteen implementation gaps where fifteen remain.
[Automated review]
…al's containers; no own regions (AST-086 FR14)
…in (FR14); no own containers
There was a problem hiding this comment.
Approval waits on one spec decision. This head rewrites spec:AST-086 FR10 and component:Toast FR9 so a ToastViewport rehosted into an open modal announces through that modal's own containers instead of containers of its own, and the earlier /approve-spec on this pull request covers an older head. An engineering owner records the decision by commenting /approve-spec <full head SHA> on this pull request; the author may do so as an engineering owner. The code itself checks out: over an open Dialog one container inside the dialog now holds each toast's words, two toasts raised together are joined, a toast raised as its Dialog closes still reaches the page, and the rewritten modal-host test fails on main and passes here.
Non-blocking:
Toast.spec.mdstill says "Sixteen implementation gaps" where fifteen are now listed.- In
ToastViewport.tsx, the file header still describes "its own persistent regions", line 324 documents a constant that no longer exists, and the new comment at lines 432-434 packs three points into one 32-word sentence.
[Automated review]
| // live role. A top-layer viewport's host moves into the latest open native | ||
| // modal, where the page's shared channel is not exposed, so it writes | ||
| // through the containers of the modal its host sits in. A |
There was a problem hiding this comment.
Non-blocking: one 32-word sentence carries three points, and the block above still says toasts go through "the persistent singleton live regions". Suggested, folded into that block: "A top-layer host moves into the latest open modal. The page channel is not exposed there. So the viewport writes to that modal's containers."
# Conflicts: # docs/specs/components/Toast/Toast.spec.md # packages/core/src/Toast/ToastViewport.tsx
There was a problem hiding this comment.
Approval waits on one spec decision, and two fixes are needed regardless.
This pull request rewrites spec:AST-086 FR10 and component:Toast FR9 so that a modal-hosted ToastViewport announces through that modal's own containers, and the existing /approve-spec names an earlier head: an engineering owner records the decision by commenting /approve-spec <full head SHA> for the head that carries the fixes below, and the author may do so as an engineering owner.
Blocking:
- Miss: the new test "announces a toast once through the modal container when an in-place viewport sits inside a Dialog" (
ToastViewport.modalHost.test.tsx:556) fails whenever the file runs on its own, because the page's shared polite region still holds the previous test's "Saved"; calling__resetLiveRegionsForTest()in anafterEach, asBottomSheetStacking.announce.test.tsxdoes, or counting only inside the dialog fixes it. - Miss:
Toast.spec.mdlines 281-282 still list "FR9: delivery through the viewport's own polite and assertive containers" as untested, which contradicts the rewritten FR9, so that entry should go or name what is still unverified.
Non-blocking: Toast.spec.md line 58 still counts seventeen implementation gaps where sixteen are listed, and the ToastViewport.tsx header and the comment at line 375 still describe the viewport's own regions.
In Chromium, one container inside the open dialog now holds each toast's words, and the card is not live.
[Automated review]
…rd and comment wording The modal-host announcement test counted a previous test's words in the page's shared polite region when the file ran alone. Toast's record now counts sixteen gaps and names what FR9 still lacks a test for; the viewport header and an orphaned comment no longer describe the viewport's own regions.
|
/approve-spec 0b5df71 |
|
/approve-spec 87e7f3b |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet; the build and test jobs are deferred until the pull request is marked ready and run before merge.
ToastViewport is now each toast's only announcement owner: a toast raised over an open Dialog is written once into the dialog's own container, and the card carries no live role. The spec:AST-086 FR10 and Toast FR9 rewrite is approved for this head, and the modal-host tests now pass when their file runs alone.
Non-blocking:
Toast.spec.md:281-283still lists the top-layer viewport's modal route under "no focused test yet", butToastViewport.modalHost.test.tsx:285tests it. Consider dropping that entry and naming the test in the FR9 verification row.
[Automated review]
| - FR9: delivery through an open modal's containers by a top-layer viewport | ||
| hosted in that modal; the modal-host test covers an in-place viewport | ||
| inside a Dialog, and the announcement tests read the shared channel. |
There was a problem hiding this comment.
Non-blocking: ToastViewport.modalHost.test.tsx:285 is a focused test of this route. The default viewport moves into a Dialog, and the test requires the toast in the dialog's polite container; it fails on the base. Consider dropping this entry and adding the modal-host announcement tests to the FR9 row of the verification map.
User impact
A screen-reader user should hear a toast exactly once. While a modal was open, a top-layer viewport (the default, rehosted above the modal) made each card its own live region, mounted already holding its text, which screen readers often skip. The viewport's channel announcement went to the page's shared region, which the modal makes inert. So a toast over a Dialog could go unannounced.
After this change:
Problem and solution fit
ToastViewportalways announced throughuseAnnounce, which follows React context, not where the rehosted host sits. While a modal hosted the top-layer viewport,isLiveRegionturned every card into its ownrole="status"/role="alert"region, mounted with its text.spec:AST-086:Fix:
enclosingModalDialog). If there is one, it writes through that modal's containers (announceInModal, FR14); otherwise it uses the shared channel.useAnnounce.isLiveRegion={false}from the viewport.Why not regions of the viewport's own: an earlier head gave the top-layer viewport its own persistent polite and assertive regions (the old FR10). Since a viewport is mounted on nearly every page, every page then carried a second empty region of each urgency. That made role-scoped lookups ambiguous: the status-message Chromium binding failed 8 states, FieldStatus included, with "expected one subject, found 2". This head adds no region.
Expected behavior and authority
spec:AST-086FR1, FR3, FR14, and FR10. FR10, its two restatements, DEC-1's sentence, and its verification row are amended here: "a globally hosted owner that AST-003 rehosts above native modals announces through the containers of the modal its host sits in (FR14), otherwise through the shared channel".component:ToastFR9: "A top-layer viewport hosted in an open modal delivers through that modal's containers (spec:AST-086 FR14); otherwise through the shared channel. The card never holds a live role."Smallest restoration
ToastViewport.tsx: the modal-aware write and cards never live. It drops the modal-outlet subscription and adds no regions.Toast.doc.mjs,types.ts: therenderContentnote no longer says the card announces itself.ToastViewport.modalHost.test.tsx: on the page, a toast is heard through the shared region. With the host in an open Dialog, it is heard through the Dialog's own polite region. The viewport has no live child, and no card is live.Scope
Testing
Writing rubric results
R1 narration: none; FR9 and FR10 state the system.
R2 research: none.
R3 evidence: none changed.
R4 rejected alternatives: none added.
R5 change references: none.
R6 open questions: none.