Repository navigation
test(core): read the live offset in the nested-scroller pull-down test - #7188
Merged
Merged
Conversation
#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.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
AI review status for this pull request.
|
Contributor
There was a problem hiding this comment.
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
activeOffsetRefto 60 and writestranslateY(60px)on the sheet element in the same sample;dragOffsetchanges 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 withexpected '' 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]
Contributor
PR Analysis Report
|
This was referenced Oct 8, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Maintainer impact
Every pull request and
mainfail theuitest project since #7169 merged:useSheetGestures.test.ts› "promotes a pull-down from the top of a nested scroller" reportsexpected +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.
dragOffset.activeOffsetRefplus the transform written directly to the sheet element. It also redefineddragOffsetto mean "the offset the host last rendered for a layout-split change". It updated every assertion that already existed, but not this new one.On
mainduring this gesture:activeOffsetRefis 60, the element transform istranslateY(60px),isTravelingis true, anddragOffsetstays 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
main(d78473f),vitest run --project ui packages/core/src/BottomSheet/useSheetGestures.test.tsfails 5/5 withexpected +0 to be 60. Bisect: it passes at 437ea17 (fix(core): BottomSheet reads the scroll edge of the box under the finger #7168) and fails starting at a83e568 (fix(core): a BottomSheet drag writes its transform per move, not per render #7169).mainshows the promoted drag moves the sheet 60px (activeOffsetRef60, transformtranslateY(60px)).Red arm. With the fixed test in place, I injected two product regressions into
useSheetGestures.ts. The test fails on each:expected +0 to be 60.expected '' to be 'translateY(60px)'.Scope
Testing
npx vitest run --project ui packages/core/src/BottomSheet/, 5 runs, all green.eslintandprettier --checkon the test file; the pre-push checks pass.