fix(react-motion): add MotionRefForwarderReset to prevent context leaking#35807
Merged
layershifter merged 2 commits intomicrosoft:masterfrom Mar 2, 2026
Merged
Conversation
…king The shared MotionRefForwarderContext can leak through component boundaries, causing descendant components (e.g. MessageBar inside Dialog) to read and nullify the parent's motion ref on unmount, breaking exit animations. MotionRefForwarderReset resets the context to `undefined` for its children. Applied in renderDialogSurface to isolate Dialog's user content. Closes microsoft#35805 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
📊 Bundle size reportUnchanged fixtures
|
|
Pull request demo site: URL |
jurokapsiar
approved these changes
Mar 2, 2026
Hotell
reviewed
Mar 3, 2026
| * Render this in components that consume `useMotionForwardedRef()` and render | ||
| * arbitrary user content, to prevent the context from leaking to descendants. | ||
| * | ||
| * @internal |
Contributor
There was a problem hiding this comment.
why are we marking things with internal when they are public ?
Member
Author
There was a problem hiding this comment.
@Hotell good question. I didn't pay attention for this comment from Claude.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
MotionRefForwarderResetcomponent to@fluentui/react-motionthat resets the sharedMotionRefForwarderContexttoundefinedfor its childrenDialogSurfaceProviderinrenderDialogSurfacewithMotionRefForwarderResetto prevent descendant components (e.g.MessageBar) from reading and corrupting Dialog's motion refuseMotionForwardedRef()unmountsTest plan
MotionRefForwarderResetadded (resets context, doesn't affect siblings)🤖 Generated with Claude Code