feat(react-motion): add MotionRefForwarder helper#35774
Merged
layershifter merged 4 commits intomicrosoft:masterfrom Feb 24, 2026
Merged
feat(react-motion): add MotionRefForwarder helper#35774layershifter merged 4 commits intomicrosoft:masterfrom
layershifter merged 4 commits intomicrosoft:masterfrom
Conversation
📊 Bundle size reportUnchanged fixtures
|
|
Pull request demo site: URL |
53bfbf0 to
cdc80d5
Compare
cdc80d5 to
3af92a0
Compare
layershifter
approved these changes
Feb 24, 2026
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.


Extracts the duplicated
MotionRefForwardercomponent anduseMotionForwardedRefhook fromreact-dialogandreact-message-barinto a shared export from@fluentui/react-motion.Changes
MotionRefForwarderanduseMotionForwardedRefas@internalexports. AddeddisplayNameand JSDoc comments. Added unit tests covering ref objects, callback refs, and absent context.MotionRefForwarder.tsxwith import from@fluentui/react-motion. Deleted the duplicate file.Motivation
Both
react-dialogandreact-message-barhad identicalMotionRefForwarderimplementations. This component forwards a motion ref through React context so that motion wrappers can pass their ref down to the actual surface element. Since the pattern is inherently tied to the motion system,@fluentui/react-motionis the natural home.No new dependency edges are introduced — both consumer packages already depend on
@fluentui/react-motion. The exports are marked@internaland do not affect the public API surface of any package.Testing
MotionRefForwarderinreact-motion:createRef)useMotionForwardedRefreturnsundefinedwhen not wrapped inMotionRefForwarderreact-motion: 75 tests, 19 suitesreact-dialog: 122 tests, 8 suitesreact-message-bar: 105 tests, 5 suitesFuture Work
MotionRefForwarderwill be used byreact-popoverto support surface motion (thefeat/popover-motionbranch), which is the primary motivation for extracting it.