fix(drag): continue autoscroll when widget dragged past root container edge#3311
Draft
developerVibhay wants to merge 1 commit into
Draft
fix(drag): continue autoscroll when widget dragged past root container edge#3311developerVibhay wants to merge 1 commit into
developerVibhay wants to merge 1 commit into
Conversation
…r edge When the scroll container is the document root, dragging a widget fully above or below the visible area should keep scrolling. Previously the 'fully outside' early return in _getClipping stopped scrolling in that case, making it impossible to scroll up by aggressively dragging near the top edge. Fix: skip the early-return only for nested (non-root) scroll containers. Add 6 unit tests covering both the nested-stop and root-continue cases.
developerVibhay
marked this pull request as draft
July 17, 2026 06:00
adumesny
approved these changes
Jul 18, 2026
Member
|
shouldn't scrolling stop when we have nothing else to scroll instead of where item is relative to scrollRect ? I mean the original scrollElement shoud continue reguadless if we enter a parent grid or not. Also your check for main view but could be a regualr parent div that still above all grid, so your logic isn't matchign to wording anyway... |
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.
Description
When a gridstack container is scrollable and you drag a widget aggressively toward the top of the browser window — pulling it fully above the container's visible area — autoscroll stops instead of continuing
to scroll up (or down when dragged below).
Root cause:
_getClipping()indd-draggable.tshad an early return for the "fully outside" case:This is correct for nested grid containers (the widget has left that grid, so the parent should take over). But when the scroll container is the document root, there is no parent to hand off to — scrolling
should continue at full speed.
Fix: Added an isRoot check so the early return only applies to nested containers:
Example: Create a gridstack grid taller than the viewport (so the page scrolls). Grab the last widget and quickly drag it toward the top of the browser window past the visible area. Before this fix, autoscroll
would halt as soon as the widget left the visible bounds. After this fix, the container continues scrolling up until it reaches the top.