fix(portal): forward the reduce motion preference and match queued update keys - #5124
Merged
Merged
Conversation
added 2 commits
September 15, 2026 10:07
Re-provide `ReduceMotionContext` in `Portal`, alongside the settings, locale and theme contexts already forwarded across the portal boundary, so portal content stops falling back to the context default of `false`.
Compare the key when looking up the queued `mount` to replace, so an update that arrives before the `PortalManager` ref is attached no longer overwrites an unrelated queued portal.
There was a problem hiding this comment.
🟢 Approval recommended
The focused fixes are correct, preserve existing behavior, and include appropriate regression coverage for the reachable case.
Pull request overview
Fixes context preservation and queued update matching across the Portal boundary.
Changes:
- Forwards reduced-motion preferences to portal content.
- Matches queued mounts and updates by portal key.
- Adds regression coverage for reduced motion.
File summaries
| File | Description |
|---|---|
src/components/Portal/PortalHost.tsx |
Corrects queued operation lookup. |
src/components/Portal/Portal.tsx |
Re-provides reduced-motion context. |
src/components/__tests__/Portal.test.tsx |
Tests reduced motion inside portals. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
k0ndee
approved these changes
Sep 16, 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.
Motivation
1. Reduce Motion is ignored inside a portal
Portalre-provides the settings, locale and theme contexts to its children, but notReduceMotionContext, souseReduceMotion()falls back tofalse. The fix forwards it too.2.
PortalHost.update()could update the wrong portalWhile operations are queued,
update()replaces a matching queuedmountorupdate- but it only compared the key on updates, so it could overwrite a different portal's queued mount. The fix compares the key for both.Related issue
Context: Notion
Screenshots / Videos
Nothing visual to capture.
Test plan
yarn test src/components/__tests__/Portal.test.tsx- 5 passed, including a new test assertinguseReduceMotion()readstrueinside aPortal. Fails onmain.yarn typecheck,yarn lint,yarn test(680 passed) - all pass.