Repository navigation
fix(Menu): only extend the submenu safe area while the pointer moves closer - #2192
Merged
Merged
Conversation
🦋 Changeset detectedLatest commit: a9b5ce9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
built with Refined Cloudflare Pages Action⚡ Cloudflare Pages Deployment
|
samitkapoor
force-pushed
the
fix/submenu-intent
branch
from
October 21, 2026 04:39
c5bbb57 to
0696256
Compare
# Conflicts: # tests/src/tests/dropdown-menu/dropdown-menu-test.svelte
Merged
This branch was successfully deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 #2191
Problem
While the pointer is inside a submenu's safe area, every
pointermoverestarts a 500ms fallback timer, whether or not the pointer is getting closer to the submenu. Moving diagonally onto a siblingSubTriggerand stopping there leaves the sibling unresponsive for ~500ms, and small movements while the pointer settles keep extending the wait.Changes
All in
MenuSubmenuIntent:SUBMENU_INTENT_TIMEOUT_MS = 100(was a hardcoded 500).Unchanged: the triangle and corridor geometry, closing immediately when the pointer leaves the safe area, the 100ms return-to-trigger delay, and the descendant sub-content path (#1945).
Why 100ms: tried on the "Nested Menus" docs demo with six sibling sub triggers. 50ms felt snappy but leaves little room for a long frame or a corrective pause near the end of a slow diagonal move; 100ms kept real moves into the submenu working while making sibling hand-off feel immediate. For reference, the transit timeout was a fixed 300ms before 2.17.0.
Result
The "Nested Menus" docs demo with this change: diagonal moves between "Status" and "Issue properties" hand off as soon as the pointer settles, and moves into either submenu still keep it open.
CleanShot.2026-10-08.at.7.08.59.PM.mp4
Tests
mainand passes with this change in Chromium and WebKit.subContentPropspassthrough (same pattern ascontentProps/subTriggerProps) so the test can setsideOffset: 16. In the test layout, the submenu sits flush against the trigger (0.27px gap in ContextMenu, 0.3px overlap in DropdownMenu), which leaves no reliable point between the two. Existing tests don't pass it, so their layout is unchanged.main.Side note (not changed here)
When a submenu opens to the left, a
pointerleaveexit point that isn't inside the corridor doesn't engage the safe area: the exit point is the intent triangle's apex, andisPointInPolygoncounts that vertex as inside for right-side submenus but outside for left-side ones. As a result, the existing ContextMenu test "should keep submenu open while pointer is moving toward it" passes without the safe area ever engaging. Happy to look at that separately if it's worth fixing.