Closed BenjaminIsMyName closed 4 months ago
I'm also having this issue in "framer-motion": "^4.1.17"
, exit animation occurs, onExitComplete fires, but the element is still in the DOM and is still interactive, I'm trying to create a modal, but when the close modal function is called, the modal animates out, but its still there, and I can't interact with the rest of the page
Also just ran into this issue when it broke our application's acceptance tests. 🤦 Seems that speed is the factor here. Removing nodes one-at-a-time, but within milliseconds of each other trips it up and leaves nodes behind.
Updating Framer motion to the latest version worked for me
Still an issue @framer-motion: 8.4.3
I am also experiencing this when nodes are removed quickly. I am using version framer-motion@8.5.2.
I'm having the same issue with 8.1.4.
Anybody have any workarounds for this bug? Due to modal use, this completely breaks the user experience.
Still an issue @framer-motion: 10.1.0
I am also noticing this issue on 10.0.1
I was facing the same issue, my mistake was that I wasn't setting the key
prop correctly in the components inside <AnimatePresence>
, now the problem is gone
I'm not sure if i'm experiencing the same bug or a similar one, but this occurs for me and is especially evident when the code runs in a background tab. When I navigate back to the tab, the exit animation cleans up and removes the 'exited' nodes. I assume this is because of some visibility/cleanup, but it would be ideal to exit animate the nodes when they're in a background tab.
(In this case, I have many videos playing audio on top of each other, and when I navigate back to make the tab active, the audio from the current video is the only one that remains playing).
In my case, the problem started with package version 10.12.12.
Video from "framer-motion": "10.12.12"
https://github.com/framer/motion/assets/56450363/02d299e1-7e07-4dbe-a99a-078614cc03a0
In the DOM:
A working version, "framer-motion": "10.12.7"
:
https://github.com/framer/motion/assets/56450363/727c31a6-98c1-4024-b5b7-20df2f3b06a1
In the DOM:
Facing the same issue, and have a sort of hacky workaround - add in an additional variable to ensure when you add & remove an item, they keys are slightly different.
For example, I have an animation that is triggered when people scroll, it animates out + in some new text. As there is only one animation on screen at a time (the bug comes along by scrolling really fast), if you introduce a new state that increments each times it changes, and append that to the key, the keys will always be unique, so it'll never go back to a key that was previously there.
You could do the same approach with a button to add/remove items, if when adding an item you store an additional UUID / incremental value / something in the data, and append that to the key, it will be unique.
This is quite hacky and not optimal, but it was the most viable workaround I could find without heaving to tear it all out.
@hiett thank you for your comment, it solved my issue while I wait for an official fix.
I also noticed similar issues on the examples: https://www.framer.com/motion/examples/#exit-animations
(Fast clicks or drags seem to be a random issue with AnimatePresence)
Also: these examples are super outdated. (I would love to see up to date examples in the docs please)
I tried to update it (5 Major versions of framer-motion, 2 major versions of React 🤦):
Before
After
https://codesandbox.io/s/framer-motion-image-gallery-forked-ccnwk9?file=/src/Example.tsx
Fixed in v10.16.5
(#2257)
1. Read the FAQs 👇
2. Describe the bug
When using the
x
style (to move the element) on theexit
prop, the element does not get removed from the DOM after the animation happens.3. IMPORTANT: Provide a CodeSandbox reproduction of the bug
https://codesandbox.io/s/fragrant-morning-kv792g?file=/src/App.js
4. Steps to reproduce
Steps to reproduce the behavior:
exit
animation! one or two of them are still there...5. Expected behavior
All elements should be removed from the DOM after the
exit
animation finished.6. Video or screenshots
https://user-images.githubusercontent.com/87870889/201490063-d0e42e1f-99f3-4d87-aa5c-e9a7cf5abe55.mp4
7. Environment details
Windows 11, Chrome 107