motion
motion copied to clipboard
[BUG] AnimatePresence with mode=popLayout doesn't consistently trigger opacity exit animations on elements with layout
2. Describe the bug
Motion elements with layout and exit animations don't always run their exit animations if they're inside an <AnimatePresence> that has a mode of "popLayout".
3. IMPORTANT: Provide a CodeSandbox reproduction of the bug
https://codesandbox.io/p/devbox/github/samselikoff/2023-11-25-framer-motion-pop-layout-bug/tree/main?file=%2Fapp%2Fpage.tsx%3A9%2C11
4. Steps to reproduce
Steps to reproduce the behavior:
- Click the "Add item" 4 times
- Click on an item. Notice it fades out.
- Click another item. Notice it disappears (its exit opacity animation is not triggered)
Behavior seems to continue, where the fade-out only happens for every other item.
5. Expected behavior
Exit animation is always applied.
6. Video or screenshots
https://github.com/framer/motion/assets/2922250/878ecf24-d382-4885-8db6-2765ab8d1e64
Interestingly if I add a different prop to the exit animation, like x: 100, it seems to work. So might be some bug related specifically to opacity!
Am experiencing the exact same issue, but in a different setup. There seem to be cases where exit is never called, and the potential for it not being called seems to be indeed tied to opacity. If I remove the opacity on my exit, it will always get called.
Here's an example. If you slowly hover over the dots on the right, it works as expected. However, once you start going faster, it sometimes bugs and multiple divs remain visible
Hey @mattgperry, Could you help or propose a workaround about this well documented issue from @samselikoff . We are also experiencing this issue in a lot of animations since 11.0.11 release.
This bug is still prevalent, any updates or workarounds?
Can confirm, still an issue
@RareSecond can confirm. I faced a similar issue as described in https://github.com/framer/motion/issues/2416#issuecomment-2066513449 recently. Have you found any workaround yet, by chance?
Tested on: "framer-motion": "^10.16.4"
Bug since version 11.0.11. Related issues: #2618 #2554 #2673
How can we help @mattgperry ?