Skip to content

test(core): read the live offset in the nested-scroller pull-down test - #7188

Merged
cixzhang merged 1 commit into
mainfrom
fix/sheet-nested-scroller-test
Oct 8, 2026
Merged

cixzhang merged 1 commit into
mainfrom
fix/sheet-nested-scroller-test

Conversation

@cixzhang

@cixzhang cixzhang commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Maintainer impact

Every pull request and main fail the ui test project since #7169 merged: useSheetGestures.test.ts › "promotes a pull-down from the top of a nested scroller" reports expected +0 to be 60. It fails 5/5 locally, so it is deterministic, not a flaky test. Contributors cannot get a green run, and the release check is blocked.

People using a BottomSheet are not affected. When they pull down from the top of a nested scroller, the sheet still follows their finger.

Intended invariant

A pull-down that starts at the top of a nested scroller, while the sheet body is also at its top, becomes a sheet drag, and the sheet follows the finger: 60px of pull moves the sheet 60px. #7168 added that behavior and this test.

Change

Root cause: the two PRs each passed alone but conflict when combined.

On main during this gesture: activeOffsetRef is 60, the element transform is translateY(60px), isTraveling is true, and dragOffset stays 0 by design. Only the stale read is wrong.

The test now checks the live offset and the element transform, the same way the other drag assertions have since #7169. This is a test-only change, so it has no Changeset.

Evidence

Red arm. With the fixed test in place, I injected two product regressions into useSheetGestures.ts. The test fails on each:

  • The sheet stops following the finger: the move handler records the base offset instead of the finger position → expected +0 to be 60.
  • The live transform write is skipped → expected '' to be 'translateY(60px)'.

Scope

  • 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

  • npx vitest run --project ui packages/core/src/BottomSheet/, 5 runs, all green.
  • eslint and prettier --check on the test file; the pre-push checks pass.

#7168 added "promotes a pull-down from the top of a nested scroller", which
asserted the sheet's position through `dragOffset`. #7169 merged 90 seconds
later from a base without that test: it moved the live drag position out of
React state (to `activeOffsetRef` and the element's transform) and redefined
`dragOffset` as the offset last rendered for a layout-split change, migrating
every existing assertion but not this new one. The product still promotes the
pull-down and moves the sheet 60px; only the stale read fails, on main and on
every PR.

Assert the live offset and the transform written to the sheet element, as the
other drag assertions do since #7169.
@vercel

vercel Bot commented Oct 8, 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 Oct 8, 2026 9:15pm UTC

Request Review

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

astracat-bot Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
⏳ Queued (for maintainers only) Oct 8, 2026, 9:38 PM UTC

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

Approving. The test now reads the sheet position where #7169 put it, and it still catches the regressions it exists to catch.

  • Main as-is (d78473f): the test file fails 1/62 with expected +0 to be 60; at this head the whole BottomSheet directory passes 245/245.
  • The hook does follow the finger in this gesture: the move handler sets activeOffsetRef to 60 and writes translateY(60px) on the sheet element in the same sample; dragOffset changes only when the layout split moves, so reading it was the stale part, not the product.
  • Red arms against the fixed test: a move handler that ignores the finger fails with expected +0 to be 60; skipping the live transform write fails with expected '' to be 'translateY(60px)'. Both arms are new coverage this test did not have before.
  • Product code is untouched, so no Changeset is right, and the BottomSheet spec stays a draft with nothing decided here.

[Automated review]

@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

PR Analysis Report

Previews ready: Storybook and Sandbox were built with this PR's docsite. CI evidence will be added when available.

View Storybook for this PR · View Sandbox for this PR

@cixzhang
cixzhang merged commit a9b5c3d into main Oct 8, 2026
44 checks passed
@cixzhang
cixzhang deleted the fix/sheet-nested-scroller-test branch October 8, 2026 21:40

This branch was successfully deployed

1 active deployment
Preview — 20a718b3 Deployed Oct 8, 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