Skip to content

test(storybook): Layer stories wait for the trigger's own layer to open after the click - #11040

Merged
cixzhang merged 4 commits into
mainfrom
ci/layer-story-open-wait
Nov 10, 2026
Merged

cixzhang merged 4 commits into
mainfrom
ci/layer-story-open-wait

Conversation

@cixzhang

@cixzhang cixzhang commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Maintainer impact

Since the vite 8.3.5 lockfile update (#10707), the story play guard fails 26 Layer story checks (13 stories at desktop and phone sizes) with No open layer. That blocks every pull request that runs the accessibility audit and guards, and it blocks the release preflight receipts for #10847.

Intended invariant

A Layer story still reads its layer's first painted frame and its settled frame, and fails on any shift between them (spec:AST-059 FR8). The stories make no other timing claim, and none changes.

Change

The story helper open() in apps/storybook/stories/Layer.stories.tsx used to click the trigger and read the open layer in the same call. With the new bundle, the click's update and the layer's showPopover run in the microtask after click() returns. That is still in the click's task, before the next paint, so nobody using the page can see it, but the synchronous read found no open layer.

open() now clicks, waits for that microtask, and then checks that the trigger's own layer (the open popover that anchors to the trigger, found with the core anchor-name reader) is open. If it is not open by then, the story fails with the layer did not open by the end of the click's task. There are no sleeps and no frame waits. The first read still happens before the first paint, so the first-frame geometry is exact, as before.

It is Storybook-only: no changeset and no changeset edits.

Evidence

  • Failure before the change: the same story play guard on the commits just before and just after chore(deps): vite 8.1.3 → 8.3.5 in the lockfile #10707 (95 targets each):
  • Measurement on the b0217fd build, 30 clicked Layer stories:
    • The 26 failing stories are not open when click() returns. All 26 are open after the next microtask (showPopover runs 14–18 ms after the click starts, inside the click's task) and at the first animation frame.
    • The 4 passing stories are open when click() returns.
    • The trigger exists in all 30 stories.
  • Success after the change: see Testing.
  • Product/runtime behavior verified unchanged: no product source changes. The layer opens in the click's task, before the next paint, in both builds.

Scope

Components: Layer stories

  • No intended public API, product behavior, visual direction, or policy change.
  • Product changes discovered during the work were removed or split.
  • Public text and artifacts contain no internal Meta context.

Testing

@vercel

vercel Bot commented Nov 10, 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 10, 2026 3:24pm UTC

Request Review

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

astracat-bot Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 10, 2026, 3:31 PM UTC

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 255fdf4

Storybook · Sandbox · built from this PR's head

Current run: Heavy CI deferred: runs when marked ready and before merge. Lint, typecheck and any path-filtered checks ran on this push.


Generated by PR Enrichment workflow | View current CI run

@cixzhang cixzhang added the ci:run-a11y Run the accessibility suite on this PR; write access, next push (AST-030 FR12) label Nov 10, 2026
@cixzhang
cixzhang marked this pull request as ready for review November 10, 2026 14:52

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

Requesting changes: the Layer story fix works (the story play guard passes on this head), but two small edits are needed.

  • The added (#11040) in .changeset/typeahead-token-backspace-clears.md makes the core changelog credit Typeahead's Backspace/Delete clear to this Storybook test fix; revert it, or cite #10847, where the feature landed.
  • readAnchorNames in apps/storybook/stories/Layer.stories.tsx copies the helper of the same name in packages/core/src/Layer/anchorName.ts; import that one instead of keeping a second parser.

Optional: no guarded story uses the two-frame fallback in layerOpened, and it can take its first read after the layer has painted once, so failing right after the microtask would keep that read exact.

[Automated review]

@cixzhang
cixzhang marked this pull request as draft November 10, 2026 15:27
@cixzhang
cixzhang marked this pull request as ready for review November 10, 2026 15:27

@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: the heavy suites on this head, including the story play guard, have not finished yet; they must pass before merge.

  • With this change all 34 Layer checks in the story play guard pass; on the base, 26 of them fail with No open layer.
  • A layer that opens even one frame late now fails by name (the layer did not open by the end of the click's task), so the first-frame check stays strict.
  • The earlier points are addressed: the Typeahead Changeset is untouched, readAnchorNames is imported from core, and the two-frame fallback is gone.

[Automated review]

@cixzhang
cixzhang merged commit 2782e0f into main Nov 10, 2026
114 of 118 checks passed
@github-actions
github-actions Bot deleted the ci/layer-story-open-wait branch November 11, 2026 06:05

This branch was successfully deployed

1 active deployment
Preview — 255fdf47 Deployed Nov 10, 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.

1 participant