Skip to content

test(bottom-sheet): assert coarse pointer before backdrop drag - #14142

Open
ashsajal1 wants to merge 1 commit into
meta:mainfrom
ashsajal1:fix/bottom-sheet-coarse-pointer-precondition
Open

ashsajal1 wants to merge 1 commit into
meta:mainfrom
ashsajal1:fix/bottom-sheet-coarse-pointer-precondition

Conversation

@ashsajal1

@ashsajal1 ashsajal1 commented Dec 1, 2026 •

Copy link
Copy Markdown

Maintainer impact

Closes #13870.

The backdrop-drag case expects the scroll lock to cancel touch moves, but that requires a coarse primary pointer. If an engine reports a fine pointer, the existing assertion reports zero cancelled moves and obscures the invalid test setup.

Intended invariant

The existing drag case must verify its coarse-pointer precondition in both Chromium and WebKit before sending touch input. The cancellation and page-position assertions remain unchanged.

Authority: architecture:component-test-sufficiency INV5–INV7 and INV11; component:BottomSheetSwitcher FR5 owns the existing scroll-lock expectation.

Change

Add a matchMedia('(pointer: coarse)').matches assertion immediately before touchDragDown(page), with a message naming the precondition. No behavior change: this changes only test diagnostics, not runtime code, emulation settings, or test selection.

Evidence

  • Failure before the change: with the coarse-pointer media query forced to false, Chromium reaches the old cancellation assertion with 12 judged moves and zero cancelled moves.
  • Success after the change: in both Chromium and WebKit, the same injected setup fails at the new assertion with Backdrop drag cancellation requires a coarse primary pointer, before any touch move is sent.
  • Product/runtime behavior verified unchanged: all six tests in the affected file pass in each engine (12/12), and the Chromium backdrop-drag case also passes three consecutive runs. No production file changes.
  • CI impact: no workflow, action, or CI-script changes.

Scope

Components: BottomSheet browser-test diagnostics only.

  • 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

  • Complete affected spec: Chromium 6/6 passed; WebKit 6/6 passed. Focused Chromium backdrop-drag test repeated separately: 3/3 passed.
  • Fine-pointer failure injection: verified the old misleading failure in Chromium and the new explicit precondition failure in both engines.
  • ESLint and Prettier on the changed spec: passed.
  • pnpm check:repo: passed, including the normal pre-commit hooks.
  • TypeScript check scoped to the affected spec and its imports: passed.
  • Fresh-session pre-review against upstream/main: no findings; public-boundary check and git diff --check passed.
  • Package-wide tsc --noEmit: exceeded the default Node heap limit. Full build-based preflight was not run.

Browser verification uses the source Storybook dev server, a temporary redirect fixture, and a local Playwright config selecting installed Chrome and Playwright WebKit. WebKit required clearing inherited Snap library-path variables. None of that verification scaffolding is included in the PR.

@vercel

vercel Bot commented Dec 1, 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 Dec 1, 2026 1:16pm UTC

Request Review

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

astracat-bot Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Dec 1, 2026, 10:19 PM UTC

@github-actions github-actions Bot added community Authored by a community contributor (not on the eng/design team) needs:code-review High-risk change (new package/component/API) — needs human code review before merge labels Dec 1, 2026
@ashsajal1
ashsajal1 marked this pull request as ready for review December 1, 2026 13:43
@ashsajal1

Copy link
Copy Markdown
Author

@cixzhang Could you review this four-line, test-only fix for #13870? All six tests in the affected spec pass in both Chromium and WebKit (12/12 total), and the independent pre-review found no issues.

The PR is still a draft. The available API access did not allow me to mark it ready for review or formally request a reviewer. Could you mark it ready as well?

@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: the test change looks right, but one statement in the description is broader than what the test does.

  • The intended invariant says the drag case verifies its coarse-pointer precondition "before sending input", but the case presses Escape in mountScrollable (BottomSheetNativeModal.a11y.browser.spec.ts line 77) before the new check at line 414, so please reword it to "before sending touch input" (or "before the drag"); no code change is needed.

From reading the code, the new check uses the same (pointer: coarse) query that gates the scroll lock's touch cancellation, and under a coarse pointer the test runs exactly as before. CI has not run on this head yet; a maintainer adds the ci:run label so it runs.

Claims and files checked

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

  • Title: the test asserts a coarse pointer before the backdrop drag: verified (spec lines 414-418).
  • Closes the linked issue (check for a coarse pointer before the drag, in both engines): verified; the check precedes touchDragDown, and the spec belongs to both the Chromium and WebKit projects.
  • The scroll lock cancels touch moves only under a coarse primary pointer: verified (gestures/pageHold.ts lines 92-105 and 244-253; the query in utils/touchQueries.ts line 16).
  • Under a fine pointer the old test fails with zero cancelled moves: verified by tracing the code; also reported for Chromium.
  • The check runs before sending input: false; Escape is pressed at line 77 first (finding above).
  • The cancellation and page-position assertions are unchanged: verified (the diff only adds 4 lines).
  • The check sits immediately before touchDragDown(page) with a message naming the precondition: verified.
  • No behavior change; no runtime code, emulation settings or test selection change: verified (one test file; test.use and the routing header unchanged).
  • The governing records the description names cover the change: verified.
  • No workflow, action or CI-script changes: verified.
  • Scope is BottomSheet browser-test diagnostics only, with no API, behavior, visual or policy change: verified.
  • Chromium and WebKit runs (6/6 each), repeated runs, the fine-pointer injection, ESLint, Prettier, repository checks, scoped TypeScript and the pre-review: reported; not run here, and CI has not run on this head.
  • File packages/core/src/BottomSheet/__tests__/BottomSheetNativeModal.a11y.browser.spec.ts: clear apart from the description finding.

Automated review (maintainer link)

@ashsajal1

Copy link
Copy Markdown
Author

Addressed the description-only finding from this review. The intended invariant now says before sending touch input. I checked that mountScrollable presses Escape before the coarse-pointer assertion, and the assertion still precedes touchDragDown(page). No code or test behavior changed.

@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 run on this head yet, so a maintainer adds the ci:run label to run it.

The reworded intended invariant ("before sending touch input") now matches the test: before the new check the case only presses Escape and makes programmatic clicks, and its first touch is the drag. From reading the code, the check uses the same (pointer: coarse) query that gates the scroll lock's touch cancellation, so under a coarse pointer the test runs exactly as before.

Claims and files checked

Review mode: same-head; reason: none

  • Live title "test(bottom-sheet): assert coarse pointer before backdrop drag": verified (spec lines 414-418).
  • Closes the linked issue (check for a coarse pointer before the drag, in both engines): verified; the check precedes touchDragDown, and the spec matches both the Chromium and the WebKit project.
  • The scroll lock cancels touch moves only under a coarse primary pointer: verified; its only touch listener is the page hold, which listens only while (pointer: coarse) matches (gestures/pageHold.ts lines 92-105 and 244-253).
  • Under a fine pointer the old test fails with zero cancelled moves: reported for Chromium (12 judged, 0 cancelled); consistent with tracing the code.
  • The check runs in both engines before sending touch input: verified; before it the case only presses Escape (line 77) and makes programmatic clicks, and the first touch is the drag at line 418.
  • The cancellation and page-position assertions are unchanged: verified (lines 423-425; the diff only adds 4 lines).
  • The check sits immediately before touchDragDown(page) with a message naming the precondition: verified.
  • The governing records the description names cover the change: verified.
  • No behavior change, and no runtime code, emulation settings or test selection change: verified (one test file; test.use and the routing header unchanged).
  • With the coarse-pointer query forced off, both engines fail at the new check before any touch move: reported; the ordering is verified in the code.
  • All six tests in the file pass in each engine (12/12), and the drag case passes three runs in a row in Chromium: the six-test count is verified (six cases in the file); the pass results are reported, and CI has not run on this head.
  • No production file changes, and no workflow, action or CI-script changes: verified.
  • Scope is BottomSheet browser-test diagnostics only, with no API, behavior, visual or policy change: verified.
  • Product changes found during the work were removed or split: reported.
  • Public text carries no internal context: verified.
  • ESLint, Prettier, the repository checks, the scoped TypeScript check, the pre-review and the whitespace check passed, and package-wide TypeScript ran out of heap: reported; the Lint and CI workflows have not run on this head.
  • The local verification scaffolding is not part of the pull request: verified (one changed file).
  • changed rules (3): Claim bounding in one round; A claim bounded by a record is bounded; The rules above still apply: checked: the live title and description, the changed spec and the records it cites, no finding.
  • File packages/core/src/BottomSheet/__tests__/BottomSheetNativeModal.a11y.browser.spec.ts: clear.

Automated review (maintainer link)

@cixzhang

cixzhang commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

🤖 (Posted by Cindy's agent.) Welcome, @ashsajal1, and thank you! A small, precise test guard is very welcome. The automated review approved it with no changes. We'll start CI and finish the maintainer checks. Nothing is needed from you right now.

@cixzhang cixzhang closed this Dec 3, 2026
@cixzhang cixzhang reopened this Dec 3, 2026
@cixzhang cixzhang added ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) ci:run-a11y Run the accessibility suite on this PR; write access, next push (AST-030 FR12) labels Dec 3, 2026
@cixzhang cixzhang closed this Dec 3, 2026
@cixzhang cixzhang reopened this Dec 3, 2026
@github-actions

github-actions Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 087ef1e

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
BottomSheet 77.9 kB (0) · 7.9 kB CSS (0) — ✓ · ✓ · —
BottomSheetSwitcher 20.0 kB (0) · 3.4 kB CSS (0) — ✓ · ✓ · —

✓ passed · ✗ needs a fix · Δ changed, for review in the shots below · ↻ needs re-verify · — did not run

Package size: no published package changed; 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

@cixzhang

cixzhang commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

/approve-spec 087ef1e

@cixzhang cixzhang 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 at this exact head.

@github-actions github-actions Bot removed the needs:code-review High-risk change (new package/component/API) — needs human code review before merge label Dec 3, 2026

This branch was successfully deployed

1 active deployment
Preview — 087ef1ee Deployed Dec 1, 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 A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) 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. community Authored by a community contributor (not on the eng/design team)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BottomSheetNativeModal browser spec: assert a coarse pointer before the backdrop drag

2 participants