Repository navigation
[navigation menu] Fix keepMounted content sizing - #4817
Conversation
commit: |
Bundle size
PerformanceTotal duration: 1,406.35 ms +92.14 ms(+7.0%) | Renders: 50 (+0) | Paint: 2,124.47 ms +139.31 ms(+7.0%)
9 tests within noise — details Check out the code infra dashboard for more information about this PR. |
✅ Deploy Preview for base-ui ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
aa9420c to
5523947
Compare
5523947 to
245b179
Compare
Code Review (GPT-5.5)Approve ✅: the keepMounted sizing bug is fixed at the shared-content-ref ownership point, the hidden-attribute sizing path is covered, and the earlier ref-stability nit is resolved. 1. Bugs / Issues (None)Root Cause & Patch AssessmentReviewed as a The follow-up change to use The Trigger-side MutationObserver expansion is also targeted: kept nested submenu switches toggle Test Coverage AssessmentThe regression coverage is proportional to the bug. The new tests cover kept nested default content during first portal entry, switching kept inline nested content, direct Validation performed:
I also verified the new kept-content regression expectations against the refreshed base implementation before the follow-up commit; the targeted cases failed there as expected, which confirms they gate the bug being fixed. |
<NavigationMenu.Content keepMounted>could transition the size of the popup on open incorrectly + fail to transition the popup dimensions when hovering over nested inline submenus.Root cause
Kept-mounted content can stay in the DOM while inactive, so it must not keep or regain ownership of the shared content ref used for popup sizing.
Before: https://stackblitz.com/edit/dwjmyhms
After: https://stackblitz.com/edit/dwjmyhms-hwgbd7w8
<NavigationMenu.Portal keepMounted>was one workaround before. Though that has a bug with the arrow transitioning (separate issue to fix)Changes
hiddenchanges and defer the first nested-content opening measurement so the popup uses the final nested content size.