motion
motion copied to clipboard
[BUG] Custom variant is stuck with stale values if the variant changes faster than the transition duration
2. Describe the bug
Changing variants rapidly (faster than the duration of the transition) can leave a variant stuck with incorrect (stale) values.
NOTE: I believe this only happens when using the
transitionEndoption for the custom variant.
3. IMPORTANT: Provide a CodeSandbox reproduction of the bug
This CSB is a fork of the image gallery one with a toggle to turn it on/off.
When off, it displays the images in a list. When on, it switches to a gallery
https://codesandbox.io/s/framer-motion-image-gallery-forked-0wy3pi?file=/src/Example.tsx
4. Steps to reproduce
Steps to reproduce the behavior:
- Load the CSB - See all images are stacked with the
"off"variant - Click on the button to toggle the slideshow on
- Click the next arrow 5 times quickly to skip to the end
- Toggle the button back to off
- Observe 2-3 of the 5 variants have the wrong position and transform css properties.
Gallery OFF

Gallery ON

5. Expected behavior
Each image wrapper should have the CSS transform properties for the "off" variant, notably "position: relative"
6. Video or screenshots
In this loom, at the end, you can see that 2 of the 5 motion components are stuck in position:fixed despite having the variant "off"
https://www.loom.com/share/543d5e95169649599d14578f781b848d
7. Environment details
Mac OS Monterey 12.1, Chrome Version 104.0.5112.79 (Official Build) (arm64)
This appears to still be an issue!