{{ message }}
Repository navigation
Fix reorder autoscroll on scrollable pages - #3481
Merged
Merged
Conversation
When the Reorder component is used on a scrollable page (without an explicit overflow: auto/scroll container), the autoscroll feature was not working because findScrollableAncestor only looked for elements with overflow: auto/scroll CSS properties. This fix adds support for page-level scrolling by: 1. Detecting when the document itself is scrollable (scrollHeight > innerHeight) 2. Using window.scrollBy() for page-level scrolling when no scrollable ancestor is found 3. Calculating scroll thresholds based on viewport dimensions instead of element bounds Fixes #3469
The core fix: clamp the scrollable container's bounds to the viewport when calculating distance from edges. Previously, if a container's bottom was at y=800 but the viewport ended at y=600, dragging to y=580 wouldn't trigger autoscroll because distanceFromEnd was 220px (well above the 50px threshold). Now we use: - start = max(0, rect.top) - end = min(viewportSize, rect.bottom) This ensures autoscroll triggers when near the *visible* edge of the container, regardless of whether the page is scrollable. Also added support for page-level scrolling (using window.scrollBy) when there's no scrollable container but the page itself is scrollable. Fixes #3469
The gesture system uses pageX/pageY coordinates (from extractEventInfo in event-info.ts), but getBoundingClientRect() returns viewport-relative coordinates. When the page is scrolled, these coordinate systems don't match, causing autoscroll to fail. For example, if the page is scrolled 500px: - pointerPosition (pageY) = 800 - rect.top (viewport) = 200 - distanceFromStart = 600 (way above 50px threshold) The fix converts the pointer position to viewport coordinates by subtracting the page scroll offset before comparing with rect bounds. Fixes #3469
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.

Fixes #3469