fluentui
fluentui copied to clipboard
[Bug]: Motion components are unable to reverse its animations if "visible" prop is toggled halfway through animation duration
Component
Motion
Package version
9.56.8
React version
16.14.0
Environment
System:
OS: Windows 11 10.0.22631
CPU: (16) x64 Intel(R) Xeon(R) Platinum 8370C CPU @ 2.80GHz
Memory: 33.98 GB / 63.95 GB
Browsers:
Edge: Chromium (134.0.3124.66)
Internet Explorer: 11.0.22621.3527
Current Behavior
We are currently using @fluentui/[email protected] and more specifically the <Collapse> component. We've noticed some jank that applies to all Motion components when it comes to toggling the visible prop halfway through the animation.
- Change
visibleprop fromtruetofalse - Halfway through the animation, toggle the
visibleprop back totrue - See the contents disappear and the enter animation kick off as if it's starting from scratch
Expected Behavior
- Change
visibleprop fromtruetofalse - Halfway through the animation, toggle the
visibleprop back totrue - Animation is reversed back to its open state with no jank
Reproduction
https://react.fluentui.dev/?path=/docs/motion-components-preview-collapse--docs#customization
Steps to reproduce
https://react.fluentui.dev/?path=/docs/motion-components-preview-collapse--docs#customization
Visit the Storybook for the preview Motion components. You can use the Collapse as a repro. Under the customization example:
- Set
playbackRateto 5% - Toggle
Visibleto false - Halfway through the animation, toggle
Visibleto true and see the animation end abruptly before starting again
GIF of repro in action:

Are you reporting an Accessibility issue?
no
Suggested severity
Low - Has or doesn't need a workaround
Products/sites affected
No response
Are you willing to submit a PR to fix?
no
Validations
- [x] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [x] The provided reproduction is a minimal reproducible example of the bug.