[pull] main from motiondivision:main#200
Merged
Conversation
When using `defaultTransition: { type: "spring" }` with a timeline
that has multiple segments for the same element, the spring type was
being spread into the final transition even though springs had already
been converted to duration-based easing functions.
This caused JSAnimation to throw "Only two keyframes currently
supported with spring" when the merged keyframes array had more than
2 keyframes.
The fix excludes `type` from `defaultTransition` when building the
final transition, since the spring has already been baked into the
easing functions array.
Fixes #3404
…ssion When a drag component unmounts while a pan session is active (e.g., the user has started a pointerdown but hasn't released yet), the PanSession's event listeners on window were not being cleaned up. This could cause touch scrolling to become disabled after the component unmounted. The fix adds a call to `this.controls.cancel()` in DragGesture.unmount() to properly clean up any active pan session and its associated window event listeners. Also adds a test to verify the cleanup behavior and a pointerCancel helper to the test setup. Fixes #3472
Safari incorrectly scales stroke-dasharray and stroke-dashoffset values when using px units during page zoom. This causes SVG path animations using pathLength to shrink progressively as the zoom level decreases. The fix removes the px unit conversion and uses unitless numeric values instead, which Safari does not scale during zoom operations. Fixes #3301
Add optional chaining (?.) and nullish coalescing (|| 0) when accessing document.body.scrollLeft and document.body.scrollTop to prevent TypeError when document.body is temporarily null during heavy DOM manipulation or aggressive reflows. Fixes #3348
Create a new useAnimatedValue hook that extends useSpring's functionality to support any motion transition type (spring, tween, inertia, keyframes). Changes: - Add attachAnimation and animatedValue functions in motion-dom - Add useAnimatedValue hook in framer-motion - Export AnimatedValueOptions type for TypeScript users - Add comprehensive tests for the new hook This addresses the feature request for a generic hook that accepts animation type in options and returns a MotionValue, providing automatic subscription management and type safety for different animation types. Fixes #3322
Reduce code duplication by making useSpring and springValue thin wrappers around the new useAnimatedValue/attachAnimation implementations. This simplifies maintenance and ensures consistent behavior across all animated value hooks. - springValue now calls animatedValue with type: "spring" - attachSpring now calls attachAnimation with type: "spring" - useSpring now calls useAnimatedValue with type: "spring" - Removed ~105 lines of duplicated code
…tioning Add anchorY prop to AnimatePresence to control vertical anchor point during exit animations in popLayout mode. Similar to the existing anchorX prop for horizontal positioning, anchorY allows choosing between "top" (default) and "bottom" positioning. When an element is originally positioned using `bottom: 0`, setting `anchorY="bottom"` ensures it maintains its position relative to the bottom of its container during exit animations, fixing the reported bug where elements would shift downward. Changes: - Add anchorY prop to AnimatePresenceProps type - Add bottom measurement in PopChild's getSnapshotBeforeUpdate - Use anchorY to determine whether to use top or bottom CSS positioning - Pass anchorY through PresenceChild to PopChild - Add test for bottom positioning preservation Fixes #3324
Previously, the drag gesture was blocked on any keyboard-accessible element (button, input, select, textarea, a) regardless of whether the element itself had the drag prop. This meant motion.button with drag prop couldn't be dragged. The fix only blocks drag when clicking on a keyboard-accessible *child* element of the draggable element. If the draggable element itself is keyboard-accessible, dragging should work when clicking directly on it. Fixes #3473
Test the measureScroll logic directly rather than trying to instantiate DocumentProjectionNode, which requires complex setup.
…vior Changed from calling cancel() to endPanSession() during unmount. The full cancel() method modifies projection animation state and releases drag locks, which can interfere with nested drag scenarios. The new endPanSession() method only cleans up the pan session event listeners on window, which is all that's needed to fix the scrolling issue without affecting nested drag behavior. Fixes the "Nested drag -- Child layout" test regression.
Rename all related functions for consistency: - useAnimatedValue → useFollowValue - animatedValue → followValue - attachAnimation → attachFollow - AnimatedValueOptions → FollowValueOptions
Fix docs typo in use-presence.ts
…-accessible-dFvfp Ensure `drag` always applies to keyboard-accessible elements
Two issues were preventing spring animations from working correctly when using defaultTransition with timeline sequences: 1. The `type` property wasn't falling back to defaultTransition.type, so segments without explicit type would use "keyframes" instead of the spring type from defaultTransition. 2. Spring properties like stiffness and damping weren't being passed from defaultTransition to the spring generator, so the spring easing function couldn't be created correctly.
Add `anchorY` prop to `AnimatePresence`
Fix path animations with Safari zoom
Fix `null` when accessing `document.body`
…3472-8gfhG Fix drag gesture after context menu opens
…ed-code-tUxB5 Fix multiple keyframes warning in timeline
…dvalue-hook-k4vRw `useFollowValue`
The tests were using short 50ms waits after cy.visit() which wasn't enough time on CI for React to mount, run useEffect, and set up layout projection. Increased to 200ms to match other stable drag tests. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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 : )