motiondivision / motion

A modern animation library for React and JavaScript
https://motion.dev
MIT License
25.96k stars 851 forks source link

[BUG] Drag-Element gets stuck when clicked while animating #2697

Open ChristianK43 opened 5 months ago

ChristianK43 commented 5 months ago

2. Describe the bug

When using an element with drag and dragConstraints enabled, the element gets stuck if it is quickly clicked while moving back inside its constraints after being dragged outside the defined boundaries. This can also happen when not using dragConstraints but instead animating the element onDragEnd.

3. IMPORTANT: Provide a CodeSandbox reproduction of the bug example without dragConstraints

example with dragConstraints

4. Steps to reproduce

Steps to reproduce the behavior:

  1. Drag the Element outside of its contraints
  2. Release the element and quickly click it again
  3. Element is now stuck

5. Expected behavior

The element should continue moving inside its constraints after the mouse is released

6. Video or screenshots

https://github.com/framer/motion/assets/68615332/b0035081-b1bf-4eef-951a-6709d0650042

7. Environment details

Chrome 125, macOS 14.5

injae-kim commented 3 months ago

Fix PR: https://github.com/framer/motion/pull/2758 PTAL! 🙇