Skip to content

Right-click context menus on canvas nodes (0285 PR4) - #425

Merged
crs48 merged 1 commit into
mainfrom
claude/stoic-taussig-b4c061
Jul 9, 2026
Merged

Right-click context menus on canvas nodes (0285 PR4)#425
crs48 merged 1 commit into
mainfrom
claude/stoic-taussig-b4c061

Conversation

@crs48

@crs48 crs48 commented Jul 9, 2026

Copy link
Copy Markdown
Owner

Completes the last deferred item of exploration 0285PR4 Canvas.

What

Right-clicking a canvas node now opens a context menu with that node's actions, matching the right-click menus already shipped across the rest of the UI (Explorer, tables, comms, tabs, data cards).

How

  • packages/canvas/src/renderer/CanvasV3.tsx — new opt-in prop nodeContextActions?: (nodeId: string) => Action[]. When present, each node island is wrapped in @xnetjs/ui's ContextMenu (a display:contents trigger, so it adds no box around the absolutely-positioned island; the menu anchors at the pointer). The menu opens on the contextmenu event; actions build lazily on open. When the prop is absent the renderer is byte-for-byte unchanged.
  • Multi-select aware — opening a node's menu keeps the whole selection if the target is already in it (Linear's rule), otherwise collapses to that single node.
  • apps/web/src/components/CanvasView.tsx — builds the verb list from getCommandRegistry().commandsForScopes(['surface:canvas']), formatting shortcuts and dispatching via runCommand.
  • The drawing controller still ignores right-click pointerdown (unchanged drawing-tools.test.ts); the menu rides the contextmenu event, so pan/marquee are untouched.

Testing

  • @xnetjs/canvas and xnet-web typecheck clean.
  • 940 canvas tests pass, including 2 new integration tests in canvas-v3.test.tsx (right-click opens the menu + selects-first + runs an item; opt-in test confirms no menu without the prop).
  • No changeset required — @xnetjs/canvas is private and apps/web is an app. Changelog fragment added (app tag).

🤖 Generated with Claude Code

PR4 of exploration 0285: add an opt-in `nodeContextActions` prop to the
CanvasV3 renderer that wraps each node island in the shared @xnetjs/ui
ContextMenu, opening on the contextmenu event. The web CanvasView builds
the verb list from commandsForScopes(['surface:canvas']). Right-clicking a
node outside the selection selects it first (else keeps the selection);
the drawing controller still ignores right-click pointerdown.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: xNet Test <test@xnet.dev>
@crs48
crs48 temporarily deployed to pr-425 July 9, 2026 04:24 — with GitHub Actions Inactive
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

🖼️ UI changes in this PR

Interactions

🎬 Open a canvas

Open a canvas

▶ Watch MP4

Auto-captured by CI · run. Informational — not a blocking check.

github-actions Bot added a commit that referenced this pull request Jul 9, 2026
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Preview removed for PR #425.

github-actions Bot added a commit that referenced this pull request Jul 9, 2026
@crs48
crs48 merged commit db11657 into main Jul 9, 2026
15 checks passed
@crs48
crs48 deleted the claude/stoic-taussig-b4c061 branch July 9, 2026 04:34
github-actions Bot added a commit that referenced this pull request Jul 9, 2026
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.

1 participant