[pull] main from motiondivision:main#199
Merged
Conversation
Enable sourcemap generation in the CJS and ES output configurations for motion-dom and motion-utils by adding the sourcemaps plugin and output option. This fixes the "Can't resolve original location of error" warnings when building with tools like Vite that rely on sourcemaps. Fixes #3431
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
Generate sourcemaps
Previously, passing null elements to animateSequence (e.g., from querySelector returning null) would throw an error. This was a regression from Motion 10's permissive behavior. Changes: - Update resolveElements in motion-dom to return empty array for null/undefined input and filter null elements from arrays - Update resolveSubjects in framer-motion to handle null/undefined subjects gracefully - Add early return for null/undefined in animateSubject and animateElements to gracefully skip (distinct from throwing for selectors that match no elements) - Add tests for null element handling in sequences Fixes #3390
…croll-VMQKK Fix reorder autoscroll on scrollable pages
Handle `null` or undefined elements
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )