Skip to content

refactor(react-message-bar): migrate slide & fade to motion components (redo) - #35168

Merged
Robert Penner (robertpenner) merged 7 commits into
microsoft:masterfrom
robertpenner:refactor/message-bar-motion
Sep 24, 2025
Merged

Robert Penner (robertpenner) merged 7 commits into
microsoft:masterfrom
robertpenner:refactor/message-bar-motion

Conversation

@robertpenner

@robertpenner Robert Penner (robertpenner) commented Sep 9, 2025 •

Copy link
Copy Markdown
Contributor

MessageBarGroup

image

Previous Behavior

• MessageBarGroup animations were implemented using react-transition-group and CSS.
• The animations did not respond to the OS animations toggle.

New Behavior

MessageBarGroup animations use motion components in a PresenceGroup.

  • The motion should look the same.
  • The motions now obey the OS animations setting. (This comes for free with the motion framework.)
  • Unused code is deleted or deprecated.
  • react-transition-group dependency is removed from all of v9! react-components is 7 kB smaller.
  • MessageBarTransition.tsx is deleted.
  • Unused styles are deleted. Unused properties and types for those styles are marked deprecated.

Testing Notes

• Test the animations in the MessageBar Animation example. (PR build)

image
• Click Add message to see messages enter; click the close button on a message to see it exit.
• When the radio button is both, the new message should enter with a fading slide, and exit with a fade.
• When the radio button is exit-only, the new message should enter without motion, and exit with a fade.
• When you disable animations in your OS setting, there should be no motions.

Related Issue(s)

• Fixes #33470


History and Background

This PR re-applies the motion component refactoring from #33465, which was originally merged on December 20, 2024, but was later reverted in #34037 on March 19, 2025 due to a critical bug discovered in issue #33914.

What happened:

  1. Original Implementation (refactor(MessageBar): migrate slide & fade to motion components #33465): Successfully migrated MessageBar animations from react-transition-group to the modern motion components framework
  2. Bug Discovery ([Bug]: MessageBarGroup breaking change requires ref forwarding #33914): The change introduced a breaking change where MessageBarGroup required all children to support ref forwarding, causing applications to crash when non-ref-forwarding components were used
  3. Emergency Revert (Revert "refactor(MessageBar): migrate slide & fade to motion components (#33465)" #34037): The feature was reverted to restore stability for affected products including Outlook
  4. Motion Framework Fix (fix(react-motion): improve element validation to work with React 19 #34164): The underlying motion framework was improved to handle ref forwarding validation gracefully, logging warnings instead of crashing

How this PR addresses the original bug:

@robertpenner Robert Penner (robertpenner) changed the title refactor(MessageBar): migrate slide & fade to motion components (re-application) refactor(MessageBar): migrate slide & fade to motion components (redone) Sep 9, 2025
@robertpenner Robert Penner (robertpenner) changed the title refactor(MessageBar): migrate slide & fade to motion components (redone) refactor(react-message-bar-group): migrate slide & fade to motion components (redone) Sep 9, 2025
@github-actions

github-actions Bot commented Sep 9, 2025 •

Copy link
Copy Markdown

📊 Bundle size report

Package & Exports Baseline (minified/GZIP) PR Change
react-components
react-components: entire library
1.284 MB
323.482 kB
1.277 MB
320.889 kB
-7.422 kB
-2.593 kB
react-message-bar
MessageBar (all components)
24.088 kB
8.96 kB
24.12 kB
8.966 kB
32 B
6 B
Unchanged fixtures
Package & Exports Size (minified/GZIP)
react-components
react-components: Button, FluentProvider & webLightTheme
68.796 kB
19.903 kB
react-components
react-components: Accordion, Button, FluentProvider, Image, Menu, Popover
236.943 kB
68.636 kB
react-components
react-components: FluentProvider & webLightTheme
43.63 kB
14.257 kB
react-portal-compat
PortalCompatProvider
8.386 kB
2.624 kB
react-timepicker-compat
TimePicker
109.935 kB
36.335 kB
🤖 This report was generated against f4a83d07d8d0dd88d254bd808c4ffb83fd264745

@robertpenner Robert Penner (robertpenner) changed the title refactor(react-message-bar-group): migrate slide & fade to motion components (redone) refactor(react-message-bar): migrate slide & fade to motion components (redone) Sep 9, 2025
@robertpenner Robert Penner (robertpenner) changed the title refactor(react-message-bar): migrate slide & fade to motion components (redone) refactor(react-message-bar): migrate slide & fade to motion components (redo) Sep 9, 2025
@github-actions

github-actions Bot commented Sep 9, 2025

Copy link
Copy Markdown

Pull request demo site: URL

@robertpenner
Robert Penner (robertpenner) marked this pull request as draft September 9, 2025 19:26
- Replace react-transition-group with @fluentui/react-motion components
- Use PresenceGroup and custom MessageBarMotion component
- Create custom fadeAtom and slideAtom motion definitions
- Remove MessageBarTransition.tsx and related CSS animations
- Add deprecation markers for unused properties
- Update to latest motion package versions (react-motion ^9.10.4, react-motion-components-preview ^0.10.0)
- Remove react-transition-group dependency

This restores the motion component refactoring from PR microsoft#33465,
which was reverted due to issue microsoft#33914. The underlying motion
framework bug has been fixed in PR microsoft#34164.
…idation tests

- Add ResizeObserver mock in jest setup for MessageBar component tests
- Required because MessageBar uses useMessageBarReflow which depends on ResizeObserver
- Add comprehensive tests for bug microsoft#33914 to validate motion components handle ref forwarding gracefully
- Tests confirm motion components now warn instead of crashing with invalid children
@robertpenner
Robert Penner (robertpenner) merged commit 6247036 into microsoft:master Sep 24, 2025
@robertpenner
Robert Penner (robertpenner) deleted the refactor/message-bar-motion branch September 24, 2025 16:56
Alexander Katrukhin (pixel-perfectionist) pushed a commit to pixel-perfectionist/fluentui that referenced this pull request Oct 8, 2025
Tudor Popa (tudorpopams) pushed a commit to tudorpopams/fluentui that referenced this pull request Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[MessageBarGroup] Investigate fade + slide migration to motion components

2 participants