[pull] main from motiondivision:main#190
Merged
Conversation
Prevents drag from starting when clicking on input, textarea, select, button, anchor, or contenteditable elements inside a draggable component. This allows normal interaction with form elements (focus, text selection) without triggering the parent's drag gesture. Fixes #1674 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Consolidates interactive element detection logic between drag and press gestures. Adds isContentEditable check to the shared utility. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Tests verify that drag gestures do not trigger when interacting with: - Button - Link (anchor) - Select dropdown - Checkbox inside label - ContentEditable element 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
When a draggable element with ref-based constraints is dragged outside its boundaries (with dragElastic), it should animate back within the constraints when released. However, if the user clicks on the element while it's animating back, the animation was being stopped and the element would get "stuck" outside the constraints. The fix: 1. Always pause (not stop) animations when pointerdown occurs, so the animation can be resumed if no drag starts 2. Resume the paused animation when the user releases without dragging (just clicking), ensuring the constraint animation continues Fixes #2697 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
When snapToCursor is used, we need to STOP the animation (not pause) because snapToCursor sets new position values. A paused animation's state would interfere with the new values being set. The pause behavior is still needed for the constraint animation fix when snapToCursor is not used. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
When using Radix UI's asChild prop with motion components inside AnimatePresence, exit animations were not running. This was because externalRef was in the useMotionRef useCallback dependency array, causing the callback to be recreated whenever Radix created a new composed ref on render. The fix stores externalRef in a ref to access the current value without including it in the dependency array. This preserves: - React 19 cleanup function support - Proper ref forwarding - AnimatePresence exit animations with libraries like Radix UI Added E2E test with @radix-ui/react-dialog to verify the fix. Fixes #3455 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
When dragging an element during a constraint animation (interrupting the animation with a new drag), the element would jump to the wrong position on release. The jump size was proportional to the second drag gesture size. Root cause: When a drag started during a paused animation, the motion value's get() returned stale data from the paused animation state instead of the current rendered position. This caused originPoint to be set incorrectly. Fix: Call stopAnimation() in onStart (when actual drag begins) to properly sync the motion value to its current position before recording originPoint. The animation lifecycle is now: 1. onSessionStart: pauseAnimation() - allows resume if no drag starts (click) 2. onStart (if drag begins): stopAnimation() - sync value for accurate originPoint 3. During drag: values set directly via set() 4. onEnd: startAnimation() - new constraint animation from correct position 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Fix AnimatePresence exit animations with Radix UI asChild
…ence-ref Revert "Fix AnimatePresence exit animations with Radix UI asChild"
…with onTap The previous tabIndex !== -1 check was too broad - it blocked drag for any element with tabIndex, including motion.div elements that automatically get tabIndex=0 when onTap is set. Now only blocks drag for actual interactive form elements (INPUT, TEXTAREA, SELECT, BUTTON, A) and contentEditable. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Fix drag constraints getting stuck when clicked during animation
When using Radix UI's asChild prop with motion components inside AnimatePresence, exit animations were not running. This was because externalRef was in the useMotionRef useCallback dependency array, causing the callback to be recreated whenever Radix created a new composed ref on render. The fix stores externalRef in a ref (updated via useInsertionEffect for concurrent mode safety) to access the current value without including it in the dependency array. This preserves: - React 19 cleanup function support - Proper ref forwarding - AnimatePresence exit animations with libraries like Radix UI Added E2E tests with @radix-ui/react-dialog to verify the fix. Fixes #3455 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Fix drag gesture triggering on interactive elements inside draggables
…ix-v2 Fix AnimatePresence exit animations with Radix UI asChild
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 : )