fix: store composed path for deferred context menu open#9645
Merged
Conversation
The context menu is opened after a server round-trip, once the opening event has finished dispatching and composedPath() returns an empty array. Store the composed path on the event while it is still dispatching, so the web component can resolve the target inside a shadow root (e.g. a grid cell) instead of the retargeted host. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
sissbruecker
approved these changes
Jul 1, 2026
web-padawan
added a commit
that referenced
this pull request
Jul 1, 2026
web-padawan
added a commit
that referenced
this pull request
Jul 1, 2026
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.



The context menu target connector opens the menu after a server round-trip: it stores the opening event, dispatches
vaadin-context-menu-before-open, and the server later calls back$contextMenuTargetConnector.openMenu, which runscontextMenu.open(storedEvent).By then the event has finished dispatching, so
event.composedPath()returns an empty array. The web component relies on the composed path to resolve the actual opening target inside a shadow root (e.g. a grid cell). With an empty path it falls back to the retargetedevent.target(the shadow host), so the menu is positioned against the host instead of the deep element.This stores the composed path on the event while it is still dispatching, so the web component can resolve the correct target when it opens the menu later.
Changes
contextMenuTargetConnector.jscapturese.__composedPath = e.composedPath()inopenOnHandlerbefore deferring. The web component reads__composedPathwhencomposedPath()is empty (see the companion web-components change).Related to vaadin/web-components#12007
🤖 Generated with Claude Code