Repository navigation
[menu] Fix submenu stuck glitch - #3783
Conversation
commit: |
Bundle size report
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. |
e205047 to
6a89a8a
Compare
a56e0e0 to
111ad3c
Compare
Greptile SummaryThis PR fixes a race condition that caused submenus to get stuck with Root CauseThe Solution
The fix maintains the same hover behavior while preventing the event listener registration race condition. Confidence Score: 5/5
Important Files Changed
|
|
I updated the playground to have an additional level of menu nesting and was able to break it a few times. I can't reliably reproduce it, though. I was randomly hovering in and out, and a couple of times the menu didn't close. Screen.Recording.2026-01-19.at.20.45.32.movI also noticed that sometimes an error appears: |
111ad3c to
baa2a56
Compare
|
@michaldudak I was able to reproduce the If you're able to reproduce & debug, that'd be helpful, otherwise this at least fixes the vast majority of the issue in the common cases |
|
I can't reproduce it reliably, unfortunately. It happens quite rarely. I'm OK with leaving it as is in this PR. |
baa2a56 to
c42b91b
Compare
The
allowMouseEntercondition is part of theuseHoverReferenceInteractionenabledstate in<Menu.Trigger>. This can undesirably switch tofalsewhile hovering submenu triggers, which causes the event listener registration effect to cleanup then re-execute. During this phase (high CPU load/many submenu triggers makes it more obvious),mouseleavemay not fire since the event listener is temporarily not registered - this prevents themousemovelistener forsafePolygon()from registering, leavingpointer-events: none;stuck since it gets cleaned up/removed by that module.Fixes #3774. The performance issue seems ~related to this but performance is somewhat subjective here as to how it should feel, at least without comparison with other libraries
https://deploy-preview-3783--base-ui.netlify.app/experiments/menu/menu-submenus