Repository navigation
feat: migrate node right-click menu to DropdownMenu primitives - #1
Draft
comfydesigner wants to merge 5 commits into
Draft
comfydesigner wants to merge 5 commits into
comfydesigner wants to merge 5 commits into
Conversation
- Rewrite NodeContextMenu.vue on top of our DropdownMenu/Sub primitives. Use the virtual-anchor pattern (fixed 0x0 trigger) with a reactive screen anchor that re-syncs from canvas transform each RAF tick while open. Pass update-position-strategy="always" so reka repositions the popper to follow canvas pan/zoom. - Inline color and shape pickers as DropdownMenuSub instead of separate popovers. Reka portals submenu content, so the FE-570 nested-list clipping workaround that motivated SubmenuPopover no longer applies. - Color submenu = grid of swatches inside DropdownMenuSubContent. - Shape submenu = standard items with check via :checkable :checked. - Delete SubmenuPopover.vue (no other consumers). - Preserve the imperative show/hide/toggle/isOpen API consumed by useMoreOptionsMenu.registerNodeOptionsInstance.
The kebab "more options" button calls toggleNodeOptions with a click event; right-click handlers call showNodeOptions with a contextmenu event. Branch on event.type so the menu anchors to the button's getBoundingClientRect (and follows it as the canvas pans/zooms) for the click path, and keeps the world-coordinate-projected anchor for the right-click path.
Replace the non-clickable 'Extensions' category label + flat sibling items with a single submenu entry. Adds a subOptions?: MenuOption[] field on MenuOption that preserves the full MenuOption shape inside the submenu (shortcuts, icons, further nesting), and extracts a recursive NodeContextMenuItem.vue so any depth of submenu renders consistently. Updates the converter and its unit tests to match the new shape.
Right-click was firing mousedown first, which focuses the input. Reka-ui DropdownMenu treats the focus change as outside the menu and immediately closes it. Block the focus by preventing default on mousedown when the right button is pressed; the contextmenu handler still fires normally to open the node menu.
- Group extension items under a single "Extensions" submenu (blocks icon) instead of a non-clickable category header; unwrap on re- structure so the submenu isn't double-nested. Recursive renderer supports extension items with their own submenus. - Suppress reka's opening-time focus-outside auto-dismiss (a right-click on a widget input focuses it) within a 300ms grace window so the menu no longer flashes open then closed; later focus-outs still dismiss. - Best-effort @pointerdown.right.prevent on widget inputs.
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.
Stacked on top of Comfy-Org#13143 (base =
context-menu-component).Summary
Migrates the node right-click / "more options" menu off PrimeVue
ContextMenu+Popoveronto our sharedDropdownMenuprimitives.Changes
DropdownMenuwith a virtual-anchor pattern. The anchor follows canvas pan/zoom while open viauseRafFn; right-click anchors to the cursor's world coordinate, kebab-button click anchors to the button's bounding box.DropdownMenuSubsubmenus instead of separate popovers. Reka portals submenu content, so the FE-570 nested-<ul>clipping workaround that motivatedSubmenuPopoverno longer applies. SubmenuPopover.vue deleted (no other consumers).Extensions ›submenu (blocks icon) instead of a non-clickable category header.buildStructuredMenuunwraps an already-built submenu so re-structuring doesn't double-nest.focus-outsideauto-dismiss within a 300ms grace window (a right-click on a widget input focuses it, which otherwise flashed the menu open→closed). Later focus-outs still dismiss normally.@pointerdown.right.preventon widget inputs (best-effort focus/selection guard).Known follow-ups
ScrubableNumberInput's nested<input>); needs a focused change in that shared component.ContextMenuprimitive (handles focus/selection/positioning natively) while keeping the kebab onDropdownMenu. Deferred — the unifiedDropdownMenupath with the grace window works and avoids two code paths.Test plan
🤖 Generated with Claude Code