You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This keeps inline nested navigation menus open while the pointer hands off into an already-open positioned descendant popup. The fix stays scoped to the shared hover interaction plus the navigation menu adapter that participates in the floating tree.
Changes
Pass the tree node id from NavigationMenuList into useHoverFloatingInteraction for inline nested menus.
Treat already-open descendant floating elements as valid hover handoff targets before closing the current menu.
Add hook-level and NavigationMenu.Root regressions covering direct and deeper mixed inline/positioned nesting.
This is still a bug-fix PR, now with tests, docs, and react-ui as the relevant secondary tags. I reviewed the full rebased branch against freshly fetched upstream/master, did a second pass over the interaction and maintainability paths touched by the final diff, and reran the targeted regression coverage that matches the current patch shape.
1. Remaining Bugs / Issues (None)
I did not find any blocking or non-blocking defects in the current branch. The final patch now lines up cleanly with the real repro shape: it fixes the tree traversal/root-cause issue in shared hover handling, adds focused regression coverage for that path, and keeps the manual experiment scoped to a single existing navigation menu instead of a throwaway sandbox.
2. Root Cause & Patch Assessment
Area
Assessment
Notes
Root cause fit
Good
The behavioral fix is now centered on making open descendants discoverable even when a contextless inline node sits between the parent and positioned popup.
Blast radius
Low
Runtime changes stay confined to getNodeChildren, useHoverFloatingInteraction, and the NavigationMenuList adapter.
Tree participation
Good
Passing nodeId from NavigationMenuList remains a small, explicit bridge for inline nested menus that do not carry their own FloatingContext node id.
3. Pattern Consistency Assessment
Area
Assessment
Notes
Shared hook usage
Good
The close guard still lives in useHoverFloatingInteraction rather than introducing NavigationMenu-specific close logic elsewhere.
Utility reuse
Good
The patch leans on getNodeChildren(..., false) and the existing shadow-DOM-safe contains helper instead of adding another descendant walker.
Local cleanup
Good
The small follow-up tidy-up to the hover guard keeps the condition readable without materially expanding the code path.
4. Edge Cases Worth Noting
Edge case
Status
Notes
Contextless intermediary node with open descendant popup
Covered
The nodes and safePolygon regressions now explicitly exercise this shape.
Real pointer travel across the submenu gap
Covered
The e2e fixture still drives the full Product -> Developers -> Composition mouse path with intermediate movement steps.
Manual repro surface
Good
The private experiment was simplified so the mixed nested submenu lives inside the existing navigation menu rather than a separate extra sandbox.
5. Test Coverage Assessment
Area
Assessment
Notes
Utility regression
Good
nodes.test.ts now covers open descendants behind a contextless intermediary node.
Hover polygon regression
Good
safePolygon.test.ts covers the same structural shape at the hover-close utility level.
Browser repro
Good
test/e2e/index.test.ts plus InlineSubmenuHoverHandoff.tsx exercise the actual pointer gap handoff path end-to-end.
Validation run
Good
Ran pnpm test:jsdom safePolygon nodes --no-watch and pnpm exec cross-env VITEST_ENV=chromium vitest run --project e2e test/e2e/index.test.ts -t "keeps the inline branch open while moving across the submenu gap into the popup".
6. Documentation / Experiment Assessment
Area
Assessment
Notes
Repro clarity
Good
The private experiment now uses the existing top-level menu and removes the extra issue-link sandbox, which makes the manual path easier to exercise.
Demo behavior
Good
The nested submenu content and transition styles are scoped to the repro path rather than changing the top-level menu structure wholesale.
7. Previous Review Issues Status
Earlier review theme
Current status
Notes
Deeper mixed inline/positioned nesting coverage
Resolved
The final branch covers the deeper structural case through nodes/safePolygon regressions plus the Playwright-backed e2e fixture.
Manual reproduction support
Improved
The private experiment is now part of the existing navigation menu, which better matches how this was debugged in practice.
Merge Confidence Score
Overall merge confidence is 4/5. I’m highly confident in the fix and the regression coverage for the reported pointer-handoff path; the remaining residual risk is mainly in adjacent hover/animation behavior that this branch does not try to normalize beyond the targeted navigation-menu repro.
In mixed nesting scenarios (inline submenus containing positioned popups), moving the pointer from an inline parent's floating element into a child's positioned popup would incorrectly close the parent — because onFloatingMouseLeave didn't know about descendant floating elements rendered outside the parent's DOM hierarchy.
Solution
Added an optional nodeId prop to useHoverFloatingInteraction so inline floating elements (which lack a FloatingContext with a nodeId) can participate in the floating tree.
In onFloatingMouseLeave, before closing, the handler now checks if the relatedTarget is inside any open child floating element — if so, it bails out.
NavigationMenuList reads the tree node id from useNavigationMenuTreeContext() and passes it through.
What looks good
Minimal, well-scoped fix — only touches the exact code paths needed.
Reuses existing utilities (contains, getNodeChildren) instead of new abstractions.
Correct fallback chain: dataRef.current.floatingContext?.nodeId ?? nodeIdProp prefers context's nodeId (positioned menus) and falls back to the explicit one (inline menus).
Shadow-DOM-aware contains is the right choice.
Both hook-level and integration tests added, including a 4-level deep mixed nesting scenario.
The boolean simplifications in NavigationMenuList.tsx (!= null checks replacing Boolean() casts and ternaries) are a nice cleanup.
No blocking issues found
The approach of extending the existing hook with an optional nodeId override is the right level of abstraction — solves the problem without restructuring the floating tree internals. Tests are thorough. Clean PR.
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
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.
Fixes #4386
This keeps inline nested navigation menus open while the pointer hands off into an already-open positioned descendant popup. The fix stays scoped to the shared hover interaction plus the navigation menu adapter that participates in the floating tree.
Changes
NavigationMenuListintouseHoverFloatingInteractionfor inline nested menus.NavigationMenu.Rootregressions covering direct and deeper mixed inline/positioned nesting.