Skip to content

Add right click menu for multiple components#14640

Open
AdRiley wants to merge 26 commits intodevelopfrom
wip/adr/add-group-context-menu
Open

Add right click menu for multiple components#14640
AdRiley wants to merge 26 commits intodevelopfrom
wip/adr/add-group-context-menu

Conversation

@AdRiley
Copy link
Member

@AdRiley AdRiley commented Jan 15, 2026

Pull Request Description

Closes #14587

  • Adds right click menu for multiple components
image
  • Adds submenus for alignment buttons
image image
  • Right click off components, de-selects and opens workflow menu
image

Important Notes

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • The documentation has been updated, if necessary.
  • Screenshots/screencasts have been attached, if there are any visual changes. For interactive or animated visual changes, a screencast is preferred.
  • All code follows the
    Scala,
    Java,
    TypeScript,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • Unit tests have been written where possible.
  • If meaningful changes were made to logic or tests affecting Enso Cloud integration in the libraries,
    or the Snowflake database integration, a run of the Extra Tests has been scheduled.
    • If applicable, it is suggested to paste a link to a successful run of the Extra Tests.

@AdRiley AdRiley changed the title Wip/adr/add group context menu Add right click menu for multiple components Jan 16, 2026
@AdRiley AdRiley marked this pull request as ready for review January 16, 2026 09:09
Comment on lines +442 to +446
function closeAllMenus() {
// Close both menus
alignmentMenuOpen.value = false
contextMenuTrigger.value?.close()
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be both menus opened by once anytime?

We usually handle such things using Interactions - an example in https://github.com/enso-org/enso/blob/develop/app/gui/src/project-view/components/DropdownMenu.vue#L28-36

Comment on lines +107 to +110
/** Whether the menu is currently open */
menuOpen: menuOpen as Ref<boolean>,
/** Two-way binding model for v-model:open that respects hover state */
menuOpenModel,
Copy link
Contributor

Choose a reason for hiding this comment

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

It's not quite clear to me, when reading menuOpen may differ from reading menuOpenModel

Copy link
Member Author

Choose a reason for hiding this comment

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

I needed menuOpenModel for getting the hover v click functionality working properly. We can look if we can simplify this, but I struggled.

@AdRiley AdRiley force-pushed the wip/adr/add-group-context-menu branch from 155510a to 54c7ee6 Compare March 16, 2026 11:40
@AdRiley AdRiley requested a review from jdunkerley as a code owner March 16, 2026 11:40
Comment on lines +94 to +98
set: (open) => {
if (!open && menuOpenedByHover.value && menuHovering.value) return
menuOpen.value = open
if (!open) menuOpenedByHover.value = false
},
Copy link
Contributor

Choose a reason for hiding this comment

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

I prefer to avoid this kind of logic in a computed's setter (conditionally setting, setting other values). It could be an independent function like trySetOpen, and then instead of v-model:open="menuOpenModel" the getter and setter can be provided separately like v-bind:open="menuOpen" @update:open="trySetOpen"

Comment on lines +28 to +30
* v-model:open="menuOpenModel"
* @pointerenter="handleMenuEnter"
* @pointerleave="handleMenuLeave"
Copy link
Contributor

Choose a reason for hiding this comment

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

Because this composable provides multiple properties to set on a component, and the relationship with the component will be the same everywhere the component is used, there's a pattern that might be applied here to simplify the API: The composable could expose an object containing all the properties that need to be connected to a dropdown menu, and then it could be used like <DropdownMenu v-bind="hoverMenuProps">. For example see

const visualization = computed((): ComponentProps<typeof GraphVisualization> => {

@close="closeAllMenus"
/>
</div>
</div>
Copy link
Contributor

Choose a reason for hiding this comment

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

DropdownMenu handles connecting a toggle button to a floating panel, and it seems like all of that same logic is needed here, is it possible to use that component to simplify this?

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess this was something I complained about in #14640 (comment) :) for me it was too much of "generalizations" (especially :deep rules), and I prefered another component for "side menus". Of course they may share some logic.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh I see! Yeah, if it's not applicable without substantial customization, it's not worth reusing it.

@AdRiley AdRiley force-pushed the wip/adr/add-group-context-menu branch from 40e0108 to 54c7ee6 Compare March 18, 2026 09:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Context menu for group of components

3 participants