Skip to content

[navigation menu] Fix nested inline menu support - #4198

Merged
atomiks merged 11 commits into
mui:masterfrom
atomiks:codex/navigation-menu-nested-inline-demo
Mar 9, 2026
Merged

atomiks merged 11 commits into
mui:masterfrom
atomiks:codex/navigation-menu-nested-inline-demo

Conversation

@atomiks

@atomiks atomiks commented Feb 26, 2026 •

Copy link
Copy Markdown
Contributor

This was previously a hidden experiment, and the popup auto resize logic failed to handle content insertions after it was refactored to the shared usePopupAutoResize hook

Preview: https://deploy-preview-4198--base-ui.netlify.app/react/components/navigation-menu#nested-inline-submenus

@atomiks atomiks added docs Improvements or additions to the documentation. component: navigation menu Changes related to the navigation menu component. labels Feb 26, 2026
@pkg-pr-new

pkg-pr-new Bot commented Feb 26, 2026 •

Copy link
Copy Markdown
  • base-ui-tanstack-start

  • vite-css-base-ui-example

    pnpm add https://pkg.pr.new/mui/base-ui/@base-ui/react@4198
    
    pnpm add https://pkg.pr.new/mui/base-ui/@base-ui/utils@4198
    

commit: 7540275

@mui-bot

mui-bot commented Feb 26, 2026 •

Copy link
Copy Markdown

Bundle size report

Bundle Parsed size Gzip size
@base-ui/react 🔺+627B(+0.14%) 🔺+115B(+0.08%)

Details of bundle changes


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

@netlify

netlify Bot commented Feb 26, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for base-ui ready!

Name Link
🔨 Latest commit c8e5163
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/69aeae813281c00008fa434c
😎 Deploy Preview https://deploy-preview-4198--base-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

@atomiks
atomiks force-pushed the codex/navigation-menu-nested-inline-demo branch 3 times, most recently from 4357f7a to 79ba397 Compare February 26, 2026 08:48
@atomiks
atomiks marked this pull request as ready for review February 26, 2026 08:53
@atomiks atomiks added type: bug It doesn't behave as expected. and removed docs Improvements or additions to the documentation. labels Feb 26, 2026
@atomiks atomiks changed the title [navigation menu][docs] Add nested inline docs demo [navigation menu] Fix nested inline menu support Feb 26, 2026
@CiscoFran10

CiscoFran10 commented Feb 27, 2026 •

Copy link
Copy Markdown
Contributor

Also consider updating the docs for NavigationMenu.Root so that delay and closeDelay are explicitly described as controlling the navigation popup, not just navigation menu. Right now it’s easy to assume they affect every item or every hover (e.g. switching between nested inline items).

context: I tried adding a delay to the nested menu so that it would not open immediately, to prevent from accidentallly opening another menu when moving the cursor in the direction of the menu content.

this cursor path sometimes accidentally opens the "Design systems" menu item.

image

ex:

  /**
   * How long to wait before the navigation popup opens. Specified in milliseconds.
   * @default 50
   */
  delay?: number | undefined;
  /**
   * How long to wait before the navigation popup closes. Specified in milliseconds.
   * @default 50
   */
  closeDelay?: number | undefined;
image

@CiscoFran10

Copy link
Copy Markdown
Contributor

context: I tried adding a delay to the nested menu so that it would not open immediately, to prevent from accidentallly opening another menu when moving the cursor in the direction of the menu content.

this cursor path sometimes accidentally opens the "Design systems" menu item.

this one is even harder 😫 :

image

@atomiks

atomiks commented Feb 27, 2026

Copy link
Copy Markdown
Contributor Author

context: I tried adding a delay to the nested menu so that it would not open immediately, to prevent from accidentallly opening another menu when moving the cursor in the direction of the menu content.

That's what blockPointerEvents in safePolygon tries to fix, but it's not working in nested menus or breaks something as you pointed out above

@atomiks
atomiks force-pushed the codex/navigation-menu-nested-inline-demo branch 8 times, most recently from f495263 to 43a7c09 Compare March 6, 2026 02:14
@atomiks
atomiks force-pushed the codex/navigation-menu-nested-inline-demo branch from 43a7c09 to 6c3a073 Compare March 6, 2026 03:25
@atomiks

atomiks commented Mar 6, 2026 •

Copy link
Copy Markdown
Contributor Author

Codex Review

Overview

This branch adds the nested inline Navigation Menu docs demo, makes inline submenu hover use the same pointer-travel protection as positioned submenus, and keeps Navigation Menu popup sizing in the older trigger-owned flow. It also adds broad regression coverage around nested inline traversal, hover stickiness, delayed nested default content, and popup resizing.

Findings

1. 🟡 Non-blocking Test fixture duplication in NavigationMenuRoot.test.tsx

Impact: The coverage is much stronger now, but the test file still carries several large Navigation Menu fixture trees that differ only in a few nested-content details. That makes future behavior changes harder to update consistently and increases the chance of one fixture drifting from the others.

Evidence: packages/react/src/navigation-menu/root/NavigationMenuRoot.test.tsx:94, :151, :226, :282, and :351 each build another top-level Navigation Menu shell with only small changes in nested content, tab-flow setup, or dynamic sizing behavior.

Recommendation: Keep the current assertions, but collapse more of the repeated root/list/portal shell into configurable helpers and pass only the nested-content differences as props. The recent dialog/popover fixture cleanup is a good direction to continue.

2. ℹ️ Informational Focused Chromium timing check does not show a hot-path slowdown

Impact: I did not find evidence here that the added hover and resize logic makes the tested trigger path slower in a meaningful way.

Evidence: I compared the latest master tip with this PR head using three Chromium runs of pnpm test:chromium NavigationMenuTrigger --no-watch, using Vitest’s reported duration from each run.

Ref Mean (s) p50 (s) p95 (s) n
master 0.82 0.76 0.98 3
PR head 1.46 1.46 1.56 3

Recommendation: No immediate action from this check alone. If maintainers want more confidence, the next step would be a browser-level interaction benchmark on the docs demo rather than test-suite timing.

No blocking issues found in this patch.

Confidence: 4/5

High confidence based on a full master...HEAD pass through the hover, safe-polygon, Navigation Menu resize, docs, and regression-test changes. I also reran focused Navigation Menu JSDOM and Chromium suites, TypeScript, and a head-versus-master Chromium timing check, but there is still some residual risk around browser-specific interaction feel that automated coverage cannot fully prove.

Notes

  • Latest changes since the previous review simplify the shared hover click-like predicate and trim some duplicated Navigation Menu test helpers without changing coverage.
  • The branch also rebases cleanly onto the current master tip.

@atomiks
atomiks force-pushed the codex/navigation-menu-nested-inline-demo branch 10 times, most recently from a1c52bb to c5efe0e Compare March 9, 2026 04:14
@atomiks
atomiks force-pushed the codex/navigation-menu-nested-inline-demo branch from 24c1378 to d7428f9 Compare March 9, 2026 11:22
@atomiks
atomiks enabled auto-merge (squash) March 9, 2026 11:34
@atomiks
atomiks disabled auto-merge March 9, 2026 11:34
@atomiks
atomiks merged commit d605923 into mui:master Mar 9, 2026
6 checks passed
@atomiks
atomiks deleted the codex/navigation-menu-nested-inline-demo branch March 9, 2026 11:34
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.

3 participants