Skip to content

fix(templates): demo actions show a toast instead of alert(), so they respond in frames that block dialogs - #12304

Merged
josephfarina merged 3 commits into
mainfrom
rl21-demo-toasts
Nov 17, 2026
Merged

josephfarina merged 3 commits into
mainfrom
rl21-demo-toasts

Conversation

@josephfarina

@josephfarina josephfarina commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

User impact

The Table Filter template (New job, and the Assign / Reschedule / Cancel bulk actions) and two example blocks (Avatar with onClick, LinkProvider custom link) call alert() for their demo actions. A page shown inside a sandboxed frame without modal permission silently ignores alert(), so in that setting the click does nothing at all, while the same page in a normal tab shows a dialog.

Problem and solution fit

  1. Why does the click do nothing? Browsers drop alert() / confirm() / prompt() in a sandboxed frame unless it allows modals.
  2. Why does it matter? These demo actions are the only feedback that the control works; a dead button reads as a bug in the component.
  3. Why a toast? Most template demo actions already use the same pattern: useToast() with a Demo: … would happen here message and a "Demo only" comment. It works in any frame and does not block the page.

Expected behavior and authority

The common template convention: most demo actions show a "Demo: …" toast (for example Shell Nav, Table Filter's own detail-panel buttons, Card and ChatComposer blocks).

Smallest restoration

  • Table Filter: the bulk-action table entries carry a demo message builder instead of an alert callback; the bar and New job call showToast.
  • Avatar and LinkProvider blocks: useToast() replaces alert().
  • New template contract test: no page template or block calls alert(), confirm() or prompt().
  • spec:AST-028 FR14 states the rule: a template demo action shows a Demo: toast and never a native dialog. Its scope now names demonstration actions, the verification map lists the new test, and an FR14 gap line records the block demo actions that still log to the console or do nothing.

Evidence

  • Reproduction before the change: the new test lists the six alert() calls (4 in Table Filter, 1 in each block).
  • Result after the change: the test passes; in a real browser, New job and Reschedule show their demo toasts and no dialog opens.
  • Representative unchanged path: Table Filter's existing detail-panel toasts and the other template tests (64 files) pass.
  • Regression test: packages/cli/api/template/no-native-dialogs.test.mjs fails on the old sources and passes on the new ones.

Scope

Components: Table Filter template, Avatar and LinkProvider blocks, spec:AST-028

  • 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

  • pnpm vitest run packages/cli/api/template (64 files passed) plus the new test
  • Built the Table Filter page and clicked New job and Reschedule in Chromium: toast shown, no dialog event
  • prettier, eslint, pnpm -F @astryxdesign/cli typecheck

Writing rubric results

R1 narration: none; FR14, the scope sentence and the gap line are present-tense statements about templates.
R2 research: none in the record.
R3 evidence: the FR14 verification row names the template contract test and its cases, no pull request.
R4 rejected alternatives: none recorded.
R5 change references: none added.
R6 open questions: none added.
R7 project status: the remaining console-log and no-op demo handlers are stated as "FR14 gap: …", not as a plan.

@vercel

vercel Bot commented Nov 17, 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 17, 2026 11:50am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 17, 2026
@astracat-bot

astracat-bot Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 17, 2026, 11:59 AM UTC

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 2880fb9

Storybook · Sandbox · built from this PR's head

Package size: @astryxdesign/cli 5.33 MB packed (+241 B); no new dependencies.

Not run on this PR: add ci:run-visual for Visual, ci:run-a11y for Accessibility, ci:run-rtl for RTL.


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.

Approval waits on an engineering owner's decision: no current spec says what a template's demo action should show, and this pull request switches six of them from alert() to the demo toast and adds a guard against native dialogs in every page and block template. An engineering owner records that decision by commenting /approve-spec <full head SHA> on this pull request (the author may do so as an engineering owner), or by pointing to the spec that governs template demo actions.

  • The description says every other template already uses the demo-toast pattern, but seven ChatComposer blocks still log sends with console.log (for example ChatComposerSimple.tsx line 13) and 50 no-op onClick handlers remain, so please reword it to something like "most template demo actions already use the same pattern".

The fix itself checks out: the new test fails on the base with exactly the six alert() calls and passes here, and in Chromium each control now shows its toast with no dialog. CI's Node test legs stop on a leg-budget check that main already fails, not on this change.

Claims and files checked

Review mode: full; reason: no-earlier-review

  • Claim: the release note says the three templates show a demo toast instead of alert() — verified (diff, Chromium clicks, astryx template output).
  • Claim: the six controls call alert(), which a sandboxed frame without modal permission ignores while a normal tab shows a dialog — verified (the new test on the base; a sandboxed-frame probe; dialogs recorded on the base).
  • Claim: browsers drop native dialogs in such frames — verified for alert() in Chromium.
  • Claim: these calls were the controls' only feedback — verified.
  • Claim: every other template already uses the demo-toast pattern — false (ChatComposer blocks log sends to the console; 50 no-op click handlers).
  • Claim: Shell Nav, Table Filter's detail panel, the Card blocks and a ChatComposer block use the demo toast — verified.
  • Claim: the restoration steps (message builder in Table Filter, toasts in both blocks, new contract test) — verified.
  • Claim: the test lists the six calls before the change and passes after it; the toasts show in a real browser with no dialog — verified.
  • Claim: Table Filter's detail-panel toasts are unchanged and the other 64 template test files pass — verified.
  • Claim: no new public API, default or interaction model, and no internal context — verified.
  • Claim: formatting, lint and the CLI typecheck pass — formatting and lint verified; the typecheck's only errors are in two untouched pages.
  • File: .changeset/templates-demo-toasts-not-alerts.md — clear
  • File: packages/cli/api/template/no-native-dialogs.test.mjs — clear
  • File: packages/cli/assets/templates/blocks/components/Avatar/AvatarInteractive.tsx — clear
  • File: packages/cli/assets/templates/blocks/components/LinkProvider/LinkProviderCustomLink.tsx — clear
  • File: packages/cli/assets/templates/pages/table-filter/page.tsx — non-blocking note on the page's size

Automated review (maintainer link)

@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 17, 2026
@josephfarina

Copy link
Copy Markdown
Contributor Author

Owner decision (engineering owner, covering this pull request): template demo actions show the demo toast and never a native dialog (alert, confirm, prompt), because a page shown in a sandboxed frame without modal permission ignores native dialogs while the toast works everywhere. The guard test enforces this on every page and block template, and spec:AST-028 FR14 states the rule.

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 788e2e6

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 17, 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: one fix to the new spec text, then this is ready for approval.

  • The new FR14 in spec:AST-028 requires every page or block demo action to show a toast that starts with Demo:, but its gap line names only block actions that log or do nothing, while the Table template's Resend invite and Export demo toasts (packages/cli/assets/templates/pages/table/page.tsx lines 461 and 550) show Invite resent to … and Exported …; prefix those toasts the FR14 way or add them to the gap line.

The engineering owner's approval at this head settles the direction, the earlier description claim is fixed, and the new guard fails on the base with exactly the six alert() calls and passes here. Two optional notes: the LinkProvider toast could say what the router would do (for example Demo: your router would navigate to /dashboard here), and the Table Filter page remains far past the page-template size guide.

Claims and files checked

Review mode: full; reason: spec-record

  • Claim: the release note says the three templates show a demo toast instead of alert() — verified (diff, astryx template output).
  • Claim: the six controls call alert(), which a sandboxed frame without modal permission ignores while a normal tab shows a dialog — verified (scan of the base, sandboxed-frame probe in Chromium).
  • Claim: browsers drop native dialogs in such frames — verified for alert() in Chromium.
  • Claim: these calls were the controls' only feedback — verified.
  • Claim: most template demo actions already use the demo-toast pattern — verified.
  • Claim: Shell Nav, Table Filter's detail panel, the Card blocks and a ChatComposer block use the demo toast — verified.
  • Claim: the restoration steps (message builder in Table Filter, toasts in both blocks, new contract test) — verified.
  • Claim: the record now owns demonstration actions, states the demo-toast rule and the dialog ban, and lists the test in its verification map — verified.
  • Claim: the gap line records the block demo actions that still log or do nothing — verified as written, but it misses the Table page's two demo toasts without the Demo: prefix.
  • Claim: the test lists the six calls before the change and passes after it, beside the other 64 template test files — verified.
  • Claim: no new public API, default or interaction model, and no internal context — verified.
  • Claim: formatting and lint pass — verified; the CLI typecheck was not rerun, as the code files are unchanged since the previous review.
  • Claim: the writing rubric results — verified against the record.
  • File: .changeset/templates-demo-toasts-not-alerts.md — clear
  • File: docs/specs/AST-028/spec.md — gap line incomplete (blocking)
  • File: packages/cli/api/template/no-native-dialogs.test.mjs — clear
  • File: packages/cli/assets/templates/blocks/components/Avatar/AvatarInteractive.tsx — clear
  • File: packages/cli/assets/templates/blocks/components/LinkProvider/LinkProviderCustomLink.tsx — optional wording note
  • File: packages/cli/assets/templates/pages/table-filter/page.tsx — optional size note

Automated review (maintainer link)

Comment thread docs/specs/AST-028/spec.md Resolved
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 2880fb9

@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: the requested change is in, and CI passed on this head.

The Table template's Resend invite and Export toasts now start with Demo: and say what would happen, which was the one change requested last time, and the router-link toast now says what the router would do. The approved demo-toast rule covers every changed control, and the new guard fails on the base with exactly the six alert() calls and passes here. One optional note: the Table Filter page is still far past the page-template size guide, which a later simplification could address.

Claims and files checked

Review mode: incremental; reason: none

  • Claim: the release note says the Table Filter template and the Avatar and LinkProvider blocks show a demo toast instead of alert() — verified (diff, rendered toasts).
  • Claim: the six controls called alert(), which a sandboxed frame without modal permission ignores while a normal tab shows a dialog — verified (scan of the base, Chromium dialog sensor and sandboxed-frame probe).
  • Claim: browsers drop native dialogs in such frames unless modals are allowed — verified for alert() in Chromium.
  • Claim: these calls were the controls' only feedback — verified.
  • Claim: most template demo actions already use the demo-toast pattern — verified.
  • Claim: Shell Nav, Table Filter's detail panel, the Card blocks and a ChatComposer block use the demo toast — verified.
  • Claim: the restoration steps (message builder in Table Filter, toasts in both blocks, new contract test) — verified.
  • Claim: the record now owns demonstration actions, states the demo-toast rule and the dialog ban, lists the test, and records the block demo actions that still log or do nothing — verified; with the Table page toasts reworded, no page demo toast is left outside the rule.
  • Claim: the test lists the six calls on the old sources and passes on the new ones, beside the other template tests — verified (65 test files pass).
  • Claim: no new public API, default or interaction model, and no internal context — verified.
  • Claim: formatting, lint and the CLI typecheck pass — verified (local formatting and lint, and CI's lint and typecheck jobs).
  • Claim: the writing rubric results — verified against the record.
  • File: .changeset/templates-demo-toasts-not-alerts.md — clear
  • File: docs/specs/AST-028/spec.md — clear
  • File: packages/cli/api/template/no-native-dialogs.test.mjs — clear
  • File: packages/cli/assets/templates/blocks/components/Avatar/AvatarInteractive.tsx — clear
  • File: packages/cli/assets/templates/blocks/components/LinkProvider/LinkProviderCustomLink.tsx — clear
  • File: packages/cli/assets/templates/pages/table-filter/page.tsx — optional size note
  • File: packages/cli/assets/templates/pages/table/page.tsx — clear

Automated review (maintainer link)

@josephfarina
josephfarina merged commit 476a315 into main Nov 17, 2026
86 checks passed
@github-actions
github-actions Bot deleted the rl21-demo-toasts branch November 18, 2026 06:04

This branch was successfully deployed

1 active deployment
Preview — 2880fb90 Deployed Nov 17, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

1 participant