Skip to content

test(Layer): browser cases for INV22, a layer and its trigger's press scale - #11028

Merged
cixzhang merged 5 commits into
mainfrom
cq-inv22
Nov 10, 2026
Merged

cixzhang merged 5 commits into
mainfrom
cq-inv22

Conversation

@cixzhang

@cixzhang cixzhang commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Maintainer impact

architecture:layer-runtime INV22 says a layer never inherits its trigger's press transform. Its verification row asked for browser cases that were not built. Without them, a reviewer cannot see which layers keep their place during a press, and a regression in the layers that do comply goes unnoticed.

Intended invariant

architecture:layer-runtime INV22 (spec:AST-059 DEC-10, recorded in #11024): "A layer never inherits its trigger's press transform. Press feedback scales only the trigger's own visual; a layer renders outside that scaled subtree and anchors to the trigger's untransformed box."

Change

  • Layer/__tests__/LayerPressTransform.interaction.browser.spec.ts: one browser case for each layer that opens from a pressable trigger, by mouse and by finger. During and after a press, it compares the open layer's rectangle, layout box and computed transform with an open that no press touched. For a layer that opens on the press, it also checks the first frame.
  • Cases that fail on main are test.fixme with an INV22: title, so they can be turned on when their fix lands. The ghost Selector finger case runs in Chromium only, because Playwright's WebKit makes no click from a raw touch press and lift.
  • docs/architecture/layer-runtime.md: the spec is in verified_by and in INV22's verification row. The INV22 gap entry lists the layers that fail today, Selector included.
  • No product code changes, so there is no changeset.

Evidence

  • Cases that pass on main (Chromium):
    • Popover with a wrapped trigger, mouse and finger.
    • DropdownMenu opening on mouse press-down, in its first frame and after the release, in Chromium: there the mouse press does not scale its trigger.
    • ContextMenu long press: its cursor anchor sits next to the children, not inside them.
  • Cases that fail on main, marked fixme, with the measured offset:
    • DropdownMenu, finger held on the trigger: the menu opens 1 px off and 2 px narrower.
    • DropdownMenu, mouse press-down in WebKit: WebKit keeps :active on the trigger, so it scales to 0.98, and the menu opens about 1 px off and 2 px narrower. The case is test.fixme in WebKit only.
    • Popover anchored through anchorRef to a Button: the popover moves 1.2 px while the Button is held. A render-prop trigger takes the same path.
    • MultiSelector (ghost), press on the open trigger: the list moves 1.3 px and gets 2.6 px narrower.
    • ComplexSelector (secondary), press on the open trigger: the list moves 1.9 px.
    • Selector (ghost and secondary), press or tap that opens the list: the list sits about 0.3 px low until it closes. Selector reads the trigger's box while the press scale is still returning to 1.
  • Product/runtime behavior verified unchanged: the PR changes no source outside the spec and the record.

In all of these gaps, the anchor is the press-scaled control itself, or a measurement of it. Measuring around the press scale in script is not a valid fix under INV22. A fix needs a structural choice, which is pending the owner's decision PS: (A) a trigger shows no press scale while its own layer is open, (B) an inner visual scales, or (C) the offset is accepted. The DropdownMenu finger case has its own fix in progress: an untransformed anchor wrapper like Popover's.

Scope

Components: Layer

  • 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

  • pnpm test:interaction --project chromium LayerPressTransform.interaction.browser.spec.ts (one worker, fresh Storybook build): 4 passed and 7 fixme. Each fixme case was also run as a plain test on main and fails. I ran it locally in Chromium only, because WebKit could not start on the test host. The WebKit results come from the automated review's run.
  • pnpm check:knowledge; pnpm specs:for --diff origin/main.

Writing rubric results

Record: docs/architecture/layer-runtime.md (the INV22 gap entry, the INV22 verification row, verified_by).

ID Result
R1 No. The changed lines state what the layers do today, in the present tense, with no proposal or history wording.
R2 No. The record has no research. The measurements stay in this pull request.
R3 No. The evidence cell names the spec file and what it proves, not a pull request or commit.
R4 No. The change adds no rejected alternative.
R5 No. The changed lines contain no pull request or issue reference.
R6 No. The change adds no open question. The pending structural choice stays out of the record.

…essed

A Selector list that opens on a press release measured the trigger while
its press scale was still returning, and settled a third of a pixel low.
Measure the trigger's block edges without its own transform.

Add browser cases for architecture:layer-runtime INV22 across Popover,
DropdownMenu, Selector, MultiSelector, ComplexSelector and ContextMenu.
The cases for gaps that need a structural decision are test.fixme.
@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 2:38pm 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, 2:47 PM UTC

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 368b5a1

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
LayerProvider 4.3 kB (0) · 20 B CSS (0) — ✓ · ✓ · ✗
layer — — — · ✓ · —
Layer — — ✓ · ✓ · —

Package size: no published package changed; no new dependencies.

API changes: none in this pull request

Committed API report behind this build: cli 36 rows, core 36 rows; run pnpm api:report.

Touched components checked; add ci:run-visual, ci:run-a11y 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.

Requesting changes: the Selector fix itself is right (a list opened by a press now lands where a keyboard open puts it, and the new unit case fails on main and passes here), but two things need to change.

  • The title says layers keep their place and size while their trigger is pressed, but only the Selector press-open path changes and four layer cases stay test.fixme, so please retitle it to the Selector fix the changeset describes.
  • getUntransformedBlockEdges in packages/core/src/Selector/hooks.ts re-implements the untransform that packages/core/src/Layer/settledBox.ts already owns, and it misses that helper's translate/scale handling and 1/64 px grid snap, so please extend the shared helper for an anchor box and call it instead.

The browser spec names INV22, which is not on main yet, so it should land after #11024.

[Automated review]

Comment thread packages/core/src/Selector/hooks.ts Resolved
Comment thread packages/core/src/Selector/hooks.ts Resolved
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 10, 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.

Requesting changes: a Selector list opened by a press now lands where a keyboard open puts it, and the new unit case fails on main and passes here, but the way the fix gets there and the title need to change.

  • Newly live check: the Selector list still anchors to the control the press scales (styles.triggerGhost and styles.triggerSecondary in Selector.tsx scale the anchor element itself), and getUntransformedBlockEdges in Selector/hooks.ts un-scales that anchor in script to compensate, which architecture:layer-runtime INV22 rules out; please keep the anchor unscaled, with the press scale on an inner visual or the list anchored to a stable wrapper as Popover does, and measure it with a plain getBoundingClientRect.
  • getUntransformedBlockEdges also re-implements the untransform that Layer/settledBox.ts owns, without its 1/64 px grid snap or its translate/scale handling, so the press-opened list still lands at 347.016 px instead of 347 px; the fix above lets you delete it, and otherwise please extend the shared helper and call it.
  • The title says layers keep their place and size while their trigger is pressed, but only Selector's press-open path changes and four layer cases stay test.fixme, so please retitle it to the Selector fix the changeset describes.

[Automated review]

Comment thread packages/core/src/Selector/hooks.ts Resolved
Comment thread docs/architecture/layer-runtime.md Resolved
@cixzhang
cixzhang marked this pull request as ready for review November 10, 2026 13:55
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec ae0c4ca

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 10, 2026
Remove the Selector placement change, its unit test and its changeset:
measuring around the press scale in script is not a valid INV22 fix.
The ghost and secondary Selector browser cases are test.fixme like the
other structural gaps, and the layer-runtime gap entry names them.

The first-frame read now waits on its frame, and the finger case waits
until the trigger, not the growing popover, is under the point.
@cixzhang cixzhang changed the title fix(core): layers keep their place and size while their trigger is pressed test(Layer): browser cases for INV22, a layer and its trigger's press scale Nov 10, 2026
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 10, 2026
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 94c746c

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

Requesting changes: in Chromium the four committed INV22 cases pass and each test.fixme case fails by the offset the description reports. WebKit fails one committed case, and the record repeats the Chromium-only result.

  • Miss: "the press that opens a DropdownMenu places the menu from the unpressed trigger" (LayerPressTransform.interaction.browser.spec.ts:224) fails in WebKit, where a mouse press gives the trigger its 0.98 :active scale and the menu opens about 1 px off and 2 px narrower, so the pr-interaction-webkit lane will fail once heavy CI runs; mark the WebKit run as an INV22 gap (for example test.fixme(browserName === 'webkit', …)).
  • Miss: docs/architecture/layer-runtime.md:669-671 says a mouse press on a DropdownMenu trigger does not scale it and keeps the menu in place, which holds in Chromium but not in WebKit; limit the sentence to Chromium and list WebKit's mouse press in the DropdownMenu gap.

The inline comments cover the smaller, non-blocking points: the verification row's fixme sentence, the spec's @output header, and the fixme ghost Selector finger case, which opens nothing in WebKit.

[Automated review]

Comment thread docs/architecture/layer-runtime.md Resolved
In WebKit a mouse press keeps :active on the DropdownMenu trigger, so
the menu that press opens sits off the unpressed box. The case is fixme
there, and the layer-runtime gap entry limits the unscaled mouse press
to Chromium. The ghost Selector finger case runs in Chromium only, and
the spec header and verification row no longer state test status.
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 10, 2026
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 368b5a1

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

The two blocking points raised earlier are fixed: the DropdownMenu mouse case is now test.fixme in WebKit only, and the INV22 gap entry in docs/architecture/layer-runtime.md states the Chromium and WebKit behavior separately. The committed spec passes in both engines (Chromium 4 cases, WebKit 3), and each INV22: fixme case fails today by the offset the description reports, so each can be turned on when its fix lands.

[Automated review]

@cixzhang
cixzhang merged commit 4398069 into main Nov 10, 2026
110 of 113 checks passed
@github-actions
github-actions Bot deleted the cq-inv22 branch November 11, 2026 06:05

This branch was successfully deployed

1 active deployment
Preview — 368b5a16 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

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