Repository navigation
fix(Toast): a toast dismissed while it opens leaves the stack - #14132
Conversation
A row dismissed before its entrance starts, or as it starts, finds no collapse to run: the browser starts no transition, so no transitionend removes the row. Once a row is leaving, a layout effect now asks getAnimations() for its grid-template-rows transition and, with none, calls onExited at once.
|
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 |
|---|---|---|---|
| Toast · Storybook | 110.7 kB (0) · 11.6 kB CSS (0) | 1,883 (+19) | ✓ · ✓ · ✓ |
Package size: @astryxdesign/core 8.14 MB packed (+397 B); no new dependencies.
Touched components checked; for the full suites, add ci:run-visual for Visual, ci:run-rtl for RTL.
Generated by PR Enrichment workflow | View full report
|
/approve-spec 50ccbf4 |
FR5's verification row now names ToastDismissWhileOpening.interaction.browser.spec.ts. It dismisses a toast as its row mounts, as its entrance starts and one frame after, with and without reduced motion.
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet. The pull request is a draft, so marking it ready for review starts the run; the ci:run label is already applied.
No blocking findings: the new layout effect ends a row's exit at once only when the browser starts no collapse for it, which restores the Toast record's rule that a dismissed card unmounts, while an open or partway-open row still waits for its collapse. The Chromium and WebKit before-and-after results come from your test plan, so the CI run of the new jsdom cases and browser spec is what confirms them at this head.
Claims and files checked
Review mode: full; reason: no-earlier-review
- Claim: a toast dismissed while it opens now leaves the stack. Verified from the code for every moment of the entrance (
ToastViewport.tsx:361-376when no transition starts,:399-401for the reverse transition); the browser spec drives all three moments. - Claim: dismissed before or as its entrance started, the row found no collapse and stayed as an empty zero-height row with its text inside. Reported; consistent with the base code, where the row unmounts only on its own
transitionendand the leaving style equals the entrance's starting style. - Claim: a row whose collapse the browser runs still waits for it to end. Verified (
ToastViewport.tsx:373,:399-401; jsdom case "keeps a dismissed Toast until its collapse ends when the browser runs one"). - Claim: a leaving row with no collapse now leaves at once, like a toast with no row on screen. Verified (
ToastViewport.tsx:373-375, compared with:784-800). - Claim: without
getAnimations(jsdom) the row keeps waiting, so existing tests are unchanged. Verified (ToastViewport.tsx:363; the test setup adds nogetAnimations, no test that renders a toast stubs it, and no existing test is edited). - Claim: the lingering row keeps the landmark, holds a
maxVisibleplace and gives F6 a hidden target. Verified on the base code (ToastViewport.tsx:1075,:891,:1036-1039). - Claim: the Toast record requires the unmount and lists a lingering row only for a viewport moving between outlets. Verified against the current record.
- Claim: one layout effect in the row syncs the exit with the browser's CSS transitions. Verified (
ToastViewport.tsx:358-376). - Claim: no new public API, visual representation, default or interaction model, and no internal context. Verified from the diff.
- Claim: the ErrorPersists story reproduces the case. Verified that the story and its button exist and that the spec drives them; the result is reported.
- Claim: the before-and-after browser runs, the unit and full test suites, lint, typecheck and repository checks. Reported; CI has not run them at this head.
- Claim: the one lint warning in the test file already exists on main. Verified (the same line, shifted by the 36 added lines).
- Claim: coordination with the open swipe pull request that delays a row's collapse. Reported; that pull request is an open draft and is not on main.
- File:
packages/core/src/Toast/ToastViewport.tsx: clear. - File:
packages/core/src/Toast/ToastViewport.test.tsx: clear. - File:
packages/core/src/Toast/__tests__/ToastDismissWhileOpening.interaction.browser.spec.ts: clear. - File:
.changeset/toast-dismissed-before-entrance-leaves.md: clear.
|
/approve-spec 8f34741 |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet; marking the draft ready for review starts it, and the ci:run label is already applied.
There are no blocking findings: the new layout effect ends a row's exit at once only when the browser starts no collapse for it, which restores the Toast record's rule that a dismissed card unmounts, while an open or partly open row still collapses first. A local Chromium check with the row's own styles showed both outcomes, and the WebKit and test-suite results come from your test plan, so CI's run confirms them at this head.
Claims and files checked
Review mode: full; reason: spec-record
- Claim (title, changeset): a toast dismissed while it opens now leaves the stack. Verified: the new effect ends the exit when no collapse runs (
ToastViewport.tsx:361-376) and the existingtransitionendpath ends it when one runs (:399-401); a local Chromium check with the row's styles showed one of the two outcomes at every entrance moment. - Claim (changeset, description): dismissed before or as its entrance started, the row found no collapse and stayed as an empty zero-height row with its text inside. Reported; consistent with the base code and with the local Chromium check of the on-mount case.
- Claim (changeset, description): a row whose collapse the browser runs still waits for it to end. Verified: the effect calls
onExitedonly when nogrid-template-rowstransition is listed (:373); in the local Chromium check an open row's collapse was listed at once and ran about 180 ms; the jsdom case "keeps a dismissed Toast until its collapse ends when the browser runs one" covers the branch. - Claim: a leaving row with no collapse now leaves at once, like a toast with no row on screen. Verified (
:373-375, compared with:784-799). - Claim: without
getAnimations(jsdom) the row keeps waiting, so existing tests are unchanged. Verified (:363; the shared test setup defines nogetAnimations, only the two new cases stub it, and no existing test is edited). - Claim: the lingering row keeps the landmark, a
maxVisibleplace and an F6 stop. Verified on the base code (:1075,:891,:1036-1039). - Claim: the Toast record requires the unmount and lists a lingering row only for a viewport moving between outlets. Verified against the current record.
- Claim: one layout effect in the row syncs the exit with the browser's CSS transitions. Verified (
:358-376). - Claim: the record's FR4–FR5 verification row names the new spec. Verified (
Toast.spec.md:267). - Claim: the ErrorPersists story reproduces the case. Verified that the story and its button exist and that the new spec drives them; the result is reported.
- Claim: no new public API, visual representation, default or interaction model, and no internal context. Verified from the diff.
- Claim: a progress toast whose work settles at once reaches the bug. Reported.
- Claim: the before-and-after browser runs in Chromium and WebKit, the unit and full suites, lint, typecheck and repository checks. Reported; CI has not run them at this head.
- Claim: the one lint warning in the test file already exists on main. Verified (the same line, shifted by the added lines).
- Claim: coordination with the open swipe pull request that delays a row's collapse. Reported; that pull request is an open draft outside this change.
- Claim: writing rubric results for the changed record cell. Verified (present tense, names a test file, no change references).
- File:
.changeset/toast-dismissed-before-entrance-leaves.md: clear. - File:
docs/specs/components/Toast/Toast.spec.md: clear. - File:
packages/core/src/Toast/ToastViewport.tsx: clear. - File:
packages/core/src/Toast/ToastViewport.test.tsx: clear. - File:
packages/core/src/Toast/__tests__/ToastDismissWhileOpening.interaction.browser.spec.ts: clear.
There was a problem hiding this comment.
Approved pending CI: the full CI run at this head, with build, test and docsite-test, is queued and has not finished, and nothing merges until it passes.
There are no blocking findings. The new layout effect ends a row's exit at once only when the browser starts no collapse for it, which restores the Toast record's rule that a dismissed card unmounts, while an open or partly open row still collapses first. Typecheck, lint and the CLI smoke test pass in CI at this head; the Chromium and WebKit results come from your test plan, and CI's full run will confirm the new tests.
Claims and files checked
Review mode: carry-forward; reason: none
- Claim (title, changeset): a toast dismissed while it opens now leaves the stack. Verified from reading the code: with no
grid-template-rowstransition listed the new effect ends the exit (ToastViewport.tsx:361-376), and a listed one ends it throughtransitionend(:399-401); the new jsdom case and browser spec contain the opening moments and wait on CI. A collapse that an outlet move cancels later still lingers, which is the record's separate known gap for every dismissed toast. - Claim (changeset, description): dismissed before or as its entrance started, the row found no collapse and stayed as an empty zero-height row with its text inside. Reported; consistent with the base code, where the leaving style equals the entrance's starting style (
:183-188,:204-207) and onlytransitionendunmounts a row. - Claim (changeset, description): a row whose collapse the browser runs still waits for it to end. Verified: the effect calls
onExitedonly when no collapse is listed (:373), and the jsdom case "keeps a dismissed Toast until its collapse ends when the browser runs one" asserts the row stays until the collapse ends. - Claim: a leaving row with no collapse now leaves at once, like a toast with no row on screen. Verified (
:373-375, compared with:784-799). - Claim: without
getAnimations(jsdom) the row keeps waiting, so existing tests are unchanged. Verified: the guard at:363; the shared test setup defines nogetAnimations; of the 15 core test files that mentionToastViewport,useToastorToastProvider, onlyToastViewport.test.tsxmentions it, in the two new cases; no existing test is edited. - Claim: the lingering row keeps the landmark, a
maxVisibleplace and an F6 stop. Verified on the base code (:1075,:891,:1036-1039). - Claim: the Toast record requires the unmount and lists a lingering row only for a viewport moving between outlets. Verified against the current record (FR5 and its known gaps).
- Claim: one layout effect in the row syncs the exit with the browser's CSS transitions. Verified (
:358-376). - Claim: the record's FR4–FR5 verification row names the new spec. Verified (
Toast.spec.md:267). - Claim: the ErrorPersists story reproduces the case. Verified that the story and its "Trigger error" button exist and that the new spec drives them; the result is reported.
- Claim: no new public API, visual representation, default or interaction model, and no internal context. Verified from the diff.
- Claim: a progress toast whose work settles at once reaches the bug. Reported.
- Claim: the before-and-after browser runs in Chromium and WebKit, the unit and full suites, lint, typecheck and repository checks. Reported; CI's typecheck and lint pass at this head, and the test suites wait on its full run.
- Claim: the one lint warning in the test file already exists on main. Verified (the same line, shifted by the 36 added lines).
- Claim: coordination with the open swipe pull request that delays a row's collapse. Reported; outside this change.
- Claim: writing rubric results for the changed record cell. Verified (present tense, names a test file, no change references).
- File:
.changeset/toast-dismissed-before-entrance-leaves.md: clear. - File:
docs/specs/components/Toast/Toast.spec.md: clear. - File:
packages/core/src/Toast/ToastViewport.tsx: clear. - File:
packages/core/src/Toast/ToastViewport.test.tsx: clear. - File:
packages/core/src/Toast/__tests__/ToastDismissWhileOpening.interaction.browser.spec.ts: clear.
|
/approve-spec 1460dad |
User impact
Why: a toast dismissed while its row opens, in the task that mounts the row or as its entrance starts, can stay for good. A "working…" toast whose work settles at once gets there. Its empty, zero-height row stays, with the text inside.
What: a leaving row that the browser runs no collapse for now leaves at once, like a toast with no row on screen (#8050). A row whose collapse runs still waits for it.
How to check: in the ErrorPersists story, dismiss the toast as its row mounts. No
[data-toast-id]row remains.Problem and solution fit
removeToastmarks the mounted row leaving and waits for itsgrid-template-rowstransition to end. Before its entrance starts, the row is still at the collapsed value that leaving goes to. A dismissal as the entrance starts can cancel it with the row still closed. Either way no collapse starts, andtransitionendnever fires.onExitednever runs, so the row stays mounted at zero height.maxVisibleplace (FR7), and an F6 stop (FR10).Expected behavior and authority
component:ToastFR5: a dismissed card collapses and fades before it unmounts. The record lists a lingering zero-height row only for a viewport moving between outlets.Smallest restoration
One layout effect in
ToastRowsyncs the exit with the browser's CSS transitions. Once the row is leaving, ifgetAnimations()shows nogrid-template-rowstransition on it, it callsonExitedat once. WithoutgetAnimations(jsdom) the row keeps waiting, so existing tests are unchanged. The record's FR4–FR5 verification row names the new spec.Evidence
main'sToastViewport.tsx, the spec fails. Chromium fails its two on-mount cases, and WebKit all six: the row stays.Scope
Components: Toast
#8121delays a leaving row's collapse until a touch retract ends. Whichever lands second keys this check onisCollapsing, notisExiting.Testing
Every run is at 8f34741, which merges
main22f1866 into this branch, afterpnpm install --frozen-lockfileandpnpm build. "Withmain's file" meansToastViewport.tsxfrom 22f1866, with Storybook rebuilt. Five steps overlapped memory pressure from other work on the machine. Each passed, apart from the three failures named below, which fail the same way in a quiet run.ToastDismissWhileOpening.interaction.browser.spec.ts,--repeat-each=5:main's file, 10 of 30 fail: both on-mount cases, 5 of 5 each (test).webkit-container.mjs: 30 of 30 pass. Withmain's file, 28 of 30 fail, each with its row still there. The case that dismisses as the entrance starts passes once in each motion setting (test).pnpm exec vitest run --project ui packages/core/src/Toast packages/core/src/Layer/toastHost.test.tsx packages/core/src/Layer/toastHost.lateRegistration.test.tsx packages/core/src/Layer/LayerProvider.test.tsx: 13 files, 200 tests pass. Withmain's file,ToastViewport.test.tsxfails 1 of 114, the new jsdom case (test).pnpm test:ui --maxWorkers=16: 1,179 files and 28,165 tests pass; none fail or skip (test).pnpm test:node, with Chromium onPATH: 30,609 tests pass, 3 are expected fails, 106 skip and 1 is a todo; 3 fail (test).useTableRowExpansionDataSource,useTableServerPaginationanduseTableTreeDataSource.main22f1866 with every target, the same three fail with the same errors (test).mainas the base, as a pull request's merge commit runs, all eight slices pass, with this change's one affected target (test).ASTRYX_STRICT_LINT=1ESLint with--max-warnings=0on the three changed files: 0 errors and 1 warning. It is the unusedviewportatToastViewport.test.tsx:4038, whichmainhas at its line 4002. This change adds none.pnpm -F @astryxdesign/core typecheck, Prettier,pnpm check:changesets,pnpm check:repo,pnpm specs:for --diff origin/mainandpnpm review:pre(0 findings) each exit 0 (test).pnpm check:knowledgeexits 0. Its two advisories are in another record onmain, which this change does not touch (test).Writing rubric results
Drafted with an AI coding agent; the tests were run as described.