Repository navigation
docs: explain where scrollTo's final offset is delivered - #1942
Closed
mdjastrzebski wants to merge 1 commit into
Closed
mdjastrzebski wants to merge 1 commit into
mdjastrzebski wants to merge 1 commit into
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LRqiwDiwMREi1PjUC5typh
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1942 +/- ##
==========================================
- Coverage 98.48% 98.36% -0.12%
==========================================
Files 84 87 +3
Lines 1581 1714 +133
Branches 432 463 +31
==========================================
+ Hits 1557 1686 +129
- Misses 24 26 +2
- Partials 0 2 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Summary
user.scrollTo()doesn't emit ascrollevent for the last drag step, which matches nativeScrollView. So a drag-only scroll such as{ y: 100 }callsonScrollwith 25, 50 and 75, and onlyonScrollEndDragreceives 100. This catches out anyone testing UI driven byonScroll(sticky headers, "scroll to top" buttons, paging dots). Their assertions fail with no obvious reason, or they change their component to work around the test.This adds a "Final scroll offset" section to the
scrollTo()API docs. It:scrollEndDrag, neveronScroll;scrollevent andmomentumScrollEnd;onScrollby adding a momentum part, e.g.{ y: 50, momentumY: 100 }, or by handlingonScrollEndDrag/onMomentumScrollEndin the component.Changed files:
website/docs/14.x/docs/api/events/user-event.mdx(source)docs/api/user-event.md(regenerated withyarn docs:generate)Test plan
yarn jest src/user-event/scroll: 24 tests passed. Existing tests inscroll-to.test.tsxalready pin down the documented event sequences (drag-only{ y: 100 }-> scroll 25/50/75, scrollEndDrag 100; with momentum, the last scroll and momentumScrollEnd both carry the final offset).yarn docs:generate: regenerateddocs/api/user-event.md.yarn format:check: passes.Known gaps:
yarn validate(docs-only change).🤖 Generated with Claude Code
https://claude.ai/code/session_01LRqiwDiwMREi1PjUC5typh
Generated by Claude Code