Skip to content

fix(Toast): the viewport is each toast's only announcement owner - #7871

Merged
cixzhang merged 8 commits into
mainfrom
fix/toast-viewport-one-owner
Nov 9, 2026
Merged

cixzhang merged 8 commits into
mainfrom
fix/toast-viewport-one-owner

Conversation

@cixzhang

@cixzhang cixzhang commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

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:

  • While an open modal hosts the viewport, each toast is announced once through that modal's own live regions.
  • Elsewhere it goes through the shared channel.
  • The card is never a live region inside a viewport.
  • No page gains extra empty live regions.

Problem and solution fit

  1. Why does it occur? ToastViewport always announced through useAnnounce, which follows React context, not where the rehosted host sits. While a modal hosted the top-layer viewport, isLiveRegion turned every card into its own role="status"/role="alert" region, mounted with its text.
  2. Why does that harm the task? A live region mounted already holding its text is often not announced, and the page-level channel is not exposed while a native modal is open.
  3. Why does that matter? spec:AST-086:
    • FR1: one owner per message.
    • FR3: a live role only on a persistent element.
    • FR14: an owner inside a modal delivers through that modal's containers.
    • FR10: amended here; a rehosted owner speaks through the modal it sits in.

Fix:

  • At write time, a top-layer viewport looks for the open modal its host sits in (enclosingModalDialog). If there is one, it writes through that modal's containers (announceInModal, FR14); otherwise it uses the shared channel.
  • An in-place viewport keeps useAnnounce.
  • The card always receives 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-086 FR1, 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:Toast FR9: "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: the renderContent note no longer says the card announces itself.
  • Tests:
    • 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.
    • An in-place viewport inside a Dialog announces once through the modal's container.
    • The status-message binding gains top-layer info and error states, which use the shared channel outside a modal.
  • A patch changeset.

Scope

  • One defect is restored.
  • Separable contradictory or unsettled tagalongs were removed or split.
  • No new public API, visual representation, default, or interaction model is hidden under the bug-fix label.
  • Public text and artifacts contain no internal Meta context.

Testing

  • Red first: the modal-hosting case fails on main, because the card is a live region while the Dialog hosts the viewport.
  • Vitest at 6e3021a (Toast and the status-message binding, 139 tests) was green. This head's run is queued.
  • Chromium status-message binding: at 6e3021a it caught the duplicate-region failure described above (8 failures). At 2da5d57 it passes 15 of 15 against that head's exact Vercel Storybook, with FieldStatus, the in-place Toast states and the top-layer Toast states all green.

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.

@vercel

vercel Bot commented Oct 22, 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 9, 2026 12:37am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 22, 2026
@github-actions github-actions Bot added the needs:design-review Affects visuals — Design should review label Oct 22, 2026
@astracat-bot

astracat-bot Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

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

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 87e7f3b

Storybook · Sandbox · built from this PR's head

Modified components

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

@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.

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.ts still expect a live toast card and a single channel subject, while the in-place viewport's always-mounted empty pair now adds a second status/alert subject, so those bindings need to move to the one-owner model.
  • CI's strict lint rejects ownRegionTimers at packages/core/src/Toast/ToastViewport.tsx:425 under @eslint-react/naming-convention-ref-name; renaming it ownRegionTimersRef clears the job.

[Automated review]

@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.

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]

cixzhang added a commit that referenced this pull request Oct 22, 2026
## 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`

@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.

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]

@gonzoblasco

Copy link
Copy Markdown
Contributor

The change itself looks right: the card drops role="status"/role="alert" and the viewport becomes the single owner. But the coverage that used to exercise the other configuration is what goes away with it, and I could not make the remaining tests add up to the contract.

What the diff removes

StatusMessage.a11y.renders.tsx drops both ToastCardHarness stories - toast-info-card-mounted and toast-error-card-mounted. Those were the only bindings that mounted a bare <Toast> (no viewport) and therefore the only ones that rendered the card without a viewport-owned channel next to it.

What the diff adds

ToastViewport.test.tsx gains one test: announces through its own regions, not the shared channel, when it is top-layer. One case, and it is the top-layer one.

The gap

spec:AST-086 FR10 says a globally hosted owner that spec:AST-003 rehosts above native modals announces through its own persistent polite and assertive containers, which move with it. The exclusion this PR adds to StatusMessage.a11y.states.ts states it as:

spec:AST-086 FR1 and FR7: the card shows the words without a live role; the ToastViewport announcement channel bound above is the one owner.

"bound above" is the part I cannot verify. The binding that remains renders only <ToastViewport isTopLayer={false}> outside a modal - the one configuration that still falls back to the shared channel. So after this diff, the configuration the exclusion names as the owner of a card with no live role is not exercised by any binding state.

Two ways this could be closed, and I do not know which is intended

  1. The isTopLayer={false} (non-modal) path keeps the shared channel as its owner, and the exclusion text should say so plainly instead of naming a viewport channel "bound above" that is not mounted there.
  2. Or the non-modal path is also meant to own its regions, in which case isTopLayer is not the switch that decides it and the condition in ToastViewport.tsx (liveRegions = (isTopLayer || isInModal) && ...) is reading the wrong flag.

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.

cixzhang pushed a commit that referenced this pull request Oct 31, 2026
…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.
@cixzhang
cixzhang force-pushed the fix/toast-viewport-one-owner branch from 361362b to 7c9325b Compare November 5, 2026 17:14
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 5, 2026
@cixzhang

cixzhang commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec c6be1e2

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 5, 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.

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 announce cancels the first one's pending write (ToastViewport.tsx:458-471), while spec:AST-086 FR10 applies FR6 (once per occasion) to these regions and the base joins both.
  • Newly live check: ToastViewport.tsx:436-471 copies the region writer that useAnnounce.ts already owns (writeModalRegion and announceMessage) without its joining, so please extract that writer to take a target element and call it from the viewport instead.
  • toast-info-announcement-top-layer and toast-error-announcement-top-layer time out in StatusMessage.a11y.test.tsx because ToastTopLayerAnnouncementHarness renders no data-a11y-ready="true" marker.
  • ToastViewport.modalHost.test.tsx:284-286 fails 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.tsx edits, 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-447 names no external system (architecture:react-component-runtime INV3) 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

@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.

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 announce cancels the first one's pending write (ToastViewport.tsx:458-471), while component:Toast FR9 announces each shown toast once and the base joins both.
  • Newly live check: ToastViewport.tsx:436-471 copies the region writer that useAnnounce.ts already owns (writeModalRegion and announceMessage) 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-447 names no external system (architecture:react-component-runtime INV3) and leaves its frame and timer running after the regions unmount when isTopLayer turns 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)
@github-actions github-actions Bot added needs:spec-owner-review Current knowledge records await owner approval and removed needs:design-review Affects visuals — Design should review labels Nov 5, 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.

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.md still 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]

Comment on lines +432 to +434
// 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

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.

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

@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.

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 an afterEach, as BottomSheetStacking.announce.test.tsx does, or counting only inside the dialog fixes it.
  • Miss: Toast.spec.md lines 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.
@cixzhang cixzhang added the ci:run-a11y Run the accessibility suite on this PR; write access, next push (AST-030 FR12) label Nov 8, 2026
@cixzhang

cixzhang commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec 0b5df71

@github-actions github-actions Bot added needs:spec-owner-review Current knowledge records await owner approval and removed needs:spec-owner-review Current knowledge records await owner approval labels Nov 9, 2026
@cixzhang

cixzhang commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec 87e7f3b

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 9, 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; 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-283 still lists the top-layer viewport's modal route under "no focused test yet", but ToastViewport.modalHost.test.tsx:285 tests it. Consider dropping that entry and naming the test in the FR9 verification row.

[Automated review]

Comment on lines +281 to +283
- 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.

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.

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.

@cixzhang
cixzhang merged commit a04d2e6 into main Nov 9, 2026
117 of 120 checks passed
@cixzhang
cixzhang deleted the fix/toast-viewport-one-owner branch November 9, 2026 04:27

This branch was successfully deployed

1 active deployment
Preview — 87e7f3b5 Deployed Nov 9, 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-a11y Run the accessibility suite on this PR; write access, next push (AST-030 FR12) 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.

2 participants