Repository navigation
Closed
Labels
Fluent UI react-components (v9)Package: motionreact-motion related changesShield: P1Shield developers rate the issue as a high priority (good issue)Status: In PRType: Bug 🐛
Description
Component
MessageBar
Package version
9.57.0
React version
18.2.0
Environment
This command does not work properly against our configuration:
"@fluentui/react": "^8.118.8",
"@fluentui/react-brand-icons": "^1.0.133",
"@fluentui/react-button": "^9.1.6",
"@fluentui/react-calendar-compat": "^0.1.12",
"@fluentui/react-card": "9.0.0-beta.34",
"@fluentui/react-charting": "^5.17.1",
"@fluentui/react-components": "^9.55.1",
"@fluentui/react-datepicker-compat": "^0.4.42",
"@fluentui/react-file-type-icons": "^8.6.0",
"@fluentui/react-hooks": "^8.5.0",
"@fluentui/react-icons": "^2.0.267",
"@fluentui/react-link": "^9.1.10",
"@fluentui/react-overflow": "^9.0.0-rc.2",
"@fluentui/react-portal-compat": "^9.0.100",
"@fluentui/react-positioning": "^9.9.21",
"@fluentui/react-provider": "^9.1.5",
"@fluentui/react-search": "^9.0.6",
"@fluentui/react-shared-contexts": "^9.1.1",
"@fluentui/react-tabster": "^9.14.6",
"@fluentui/react-text": "9.1.8",
"@fluentui/react-theme": "^9.1.1",
"@fluentui/react-theme-sass": "^9.0.0-alpha.20",
"@fluentui/react-timepicker-compat": "^0.2.20",
"@fluentui/react-utilities": "^9.1.2",
"@fluentui/react-window-provider": "^2.1.0",
"@fluentui/style-utilities": "^8.6.0",
"@fluentui/theme": "^2.4.11",
"@fluentui/utilities": "^8.13.19",
"react": "^18.2.0",
"react-csv": "^2.0.3",
"react-dom": "^18.2.0",
"react-easy-crop": "^5.0.8",
"react-horizontal-scrolling-menu": "0.7.10",
"react-infinite-scroll-component": "^5.1.0",
"react-inspector": "^2.2.2",
"react-redux": "^7.1.0",
"react-relay": "^18.1.0",
"react-router": "^6.22.3",
"react-router-dom": "^6.22.3",
"react-transition-group": "^4.2.1",
"react-virtualized-auto-sizer": "^1.0.6",
"react-vtree": "^2.0.4",
"react-webcam": "^7.1.1",
"react-window": "^1.8.7",Current Behavior
When using a MessageBargGroup component, the inclusion of react-motion requires that the child element accepts a ref. Passing an element that cannot forward a ref (such as an array of elements) will result in an application crash.
Expected Behavior
Do not throw in these cases.
Reproduction
Steps to reproduce
- Click on
Add messagebutton - Observe the uncaught error in the console.
Are you reporting an Accessibility issue?
no
Suggested severity
Urgent - No workaround and Products/sites are affected
Products/sites affected
Outlook
Are you willing to submit a PR to fix?
no
Validations
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- The provided reproduction is a minimal reproducible example of the bug.
Metadata
Metadata
Assignees
Labels
Fluent UI react-components (v9)Package: motionreact-motion related changesShield: P1Shield developers rate the issue as a high priority (good issue)Status: In PRType: Bug 🐛
Activity
miroslavstastny commentedon Feb 27, 2025
cc Oleksandr Fediashov (@layershifter), Robert Penner (@robertpenner)
smhigley commentedon Mar 3, 2025
Walter Barrantes (@wbarrantes) do you have a more complete description of your use case? In the linked stackblitz, the issue could be easily solved with
React.forwardRef, but I'm guessing the actual use case is more complex.The error is there because I believe
react-motiondoes actually need a ref to work. Is there a reason to useMessageBargGroupat all, if you don't want the motion to work? As a control, it doesn't really do anything aside from providing animations to the child MessageBar components.wbarrantes commentedon Mar 3, 2025
Hi Sarah Higley (@smhigley) | The Stackblitz example may not fully represent our situation in Outlook, which appears to be more complex. Although I am not an expert on the specific use case, it is important to note that a recent change involving the refactor(MessageBar): migrate slide & fade to motion components by robertpenner · Pull Request #33465 · microsoft/fluentui has caused an issue. The
MessageBarGroupwas updated to use motion components, resulting in a break in our application. As a result, this change needs to be either reverted or fixed.Currently, we have a pinned dependency in our
package.json, which is preventing us from updating@fluentui/react-componentsto the latest version. Oleksandr Oleksandr Fediashov (@layershifter) mentioned there is a technique used previously for a similar issue with Dialog that might be applicable here: fix(Dialog): do not require ref forwarding by layershifter · Pull Request #32095 · microsoft/fluentuiIf resolving this fix will take some time, please consider reverting the change temporarily and then addressing the fix in a future version of
react-componentsthat accounts for cases where child elements do not support ref forwarding.Thank you!
refactor(MessageBar): migrate slide & fade to motion components
test(MessageBar): add ResizeObserver mock and bug microsoft#33914 val…
refactor(MessageBar): migrate slide & fade to motion components
test(MessageBar): add ResizeObserver mock and bug microsoft#33914 val…
robertpenner commentedon Sep 23, 2025
Walter Barrantes (@wbarrantes) We have a PR to redo the MessageBarGroup motion migration without the breaking change, in PR #35168.
refactor(MessageBar): migrate slide & fade to motion components
test(MessageBar): add ResizeObserver mock and bug microsoft#33914 val…