Skip to content

Conversation

@gonfunko
Copy link
Contributor

The basics

The details

Resolves

Fixes #8842

Proposed Changes

This PR updates Gesture to check for conformance to IContextMenu when dispatching right clicks, rather than hard coding specific kinds of elements.

Although Gesture is still fairly closely tied to specific elements, in general this does open a path for things to just implement IContextMenu to get context menu support. Clicks bubble up from e.g. fields to blocks to the workspace, with each item informing Gesture of a click in turn, and the workspace handler is what ultimately triggers the right click handler. Thus, as long as an element (a) gains focus on (right)click, (b) is a child of the workspace, and (c) implements IContextMenu, Gesture should now trigger display of the context menu when it is right clicked.

While I was here, I also cleaned up the bringing-block-to-front behavior. This was being triggered in various block sub-elements (fields, icons), but because of the bubbling behavior described above, clicks on those will ultimately reach the parent block, so performing bring-to-front when the block becomes the target block covers all these cases, for both left and right clicks.

Copy link
Collaborator

@BenHenning BenHenning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @gonfunko! Just one comment to double check one of the bringBlockToFront removals that I don't think is covered by tests, but otherwise this LGTM.

@gonfunko gonfunko merged commit 65bc2b5 into main Jan 27, 2026
12 checks passed
@gonfunko gonfunko deleted the context-menus branch January 27, 2026 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update gesture code to check for IContextMenu

3 participants