Repository navigation
test(storybook): Layer stories wait for the trigger's own layer to open after the click - #11040
Conversation
…en after the click
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
There was a problem hiding this comment.
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.mdmakes the core changelog credit Typeahead's Backspace/Delete clear to this Storybook test fix; revert it, or cite #10847, where the feature landed. readAnchorNamesinapps/storybook/stories/Layer.stories.tsxcopies the helper of the same name inpackages/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]
… the click's task, and reuse the core anchor-name reader
There was a problem hiding this comment.
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,
readAnchorNamesis imported from core, and the two-frame fallback is gone.
[Automated review]
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()inapps/storybook/stories/Layer.stories.tsxused to click the trigger and read the open layer in the same call. With the new bundle, the click's update and the layer'sshowPopoverrun in the microtask afterclick()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 withthe 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
playFunctionThrewException — Error: No open layer.click()returns. All 26 are open after the next microtask (showPopoverruns 14–18 ms after the click starts, inside the click's task) and at the first animation frame.click()returns.Scope
Components: Layer stories
Testing
No open layer.showPopoverdo nothing for core-layer--trigger-near-edge-flips): 93 of 95 pass. All 32 other Layer checks pass. The 2 mutant checks (desktop and phone) fail withplayFunctionThrewException — Error: the layer did not open by the end of the click's task.click()returns, so it is open after the microtask too, and the strict check passes there by construction. An earlier, looser form of this fix (a two-frame wait) went 95/95 on 4978d49, the commit before chore(deps): vite 8.1.3 → 8.3.5 in the lockfile #10707.pr-a11yandStable visual regressionpass, and the whole run is green.eslintandprettier --checkon the story file: clean.