Skip to content

[navigation menu] Fix keepMounted content sizing#4817

Open
atomiks wants to merge 1 commit into
mui:masterfrom
atomiks:codex/navigation-menu-keep-mounted-sizing
Open

[navigation menu] Fix keepMounted content sizing#4817
atomiks wants to merge 1 commit into
mui:masterfrom
atomiks:codex/navigation-menu-keep-mounted-sizing

Conversation

@atomiks
Copy link
Copy Markdown
Contributor

@atomiks atomiks commented May 13, 2026

<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

  • Keep the shared current content ref owned only by active content, and clear it only when that same content closes.
  • Observe hidden changes and defer the first nested-content opening measurement so the popup uses the final nested content size.
  • Add regression coverage for kept nested content opening, hidden changes, close/reopen, and mixed kept/unmounted siblings.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 13, 2026

commit: 245b179

@code-infra-dashboard
Copy link
Copy Markdown

code-infra-dashboard Bot commented May 13, 2026

Bundle size

Bundle Parsed size Gzip size
@base-ui/react 🔺+54B(+0.01%) 🔺+19B(+0.01%)

Details of bundle changes

Performance

Total duration: 1,108.90 ms +16.74 ms(+1.5%) | Renders: 50 (+0) | Paint: 1,699.46 ms +35.68 ms(+2.1%)

Test Duration Renders
Select open (500 options) 55.55 ms 🔺+11.43 ms(+25.9%) 14 (+0)

11 tests within noise — details


Check out the code infra dashboard for more information about this PR.

@atomiks atomiks added the type: bug It doesn't behave as expected. label May 13, 2026 — with ChatGPT Codex Connector
@netlify
Copy link
Copy Markdown

netlify Bot commented May 13, 2026

Deploy Preview for base-ui ready!

Name Link
🔨 Latest commit 245b179
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/6a043d94ca48b500088b0643
😎 Deploy Preview https://deploy-preview-4817--base-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@atomiks atomiks added the component: navigation menu Changes related to the navigation menu component. label May 13, 2026 — with ChatGPT Codex Connector
@atomiks atomiks force-pushed the codex/navigation-menu-keep-mounted-sizing branch from aa9420c to 5523947 Compare May 13, 2026 08:43
@atomiks atomiks force-pushed the codex/navigation-menu-keep-mounted-sizing branch from 5523947 to 245b179 Compare May 13, 2026 09:00
@atomiks atomiks marked this pull request as ready for review May 13, 2026 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: navigation menu Changes related to the navigation menu component. type: bug It doesn't behave as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant