Editor has no 'duplicate path' shortcut — user with 10 mirrored petals must draw each one individually even though the Edit menu has no Duplicate Path entry #213

Closed
opened 2026-10-04 00:02:07 +00:00 by Mark · 1 comment
Owner

Finding

src/components/editor/Editor.tsx's keyboard shortcuts hook (useKeyboardShortcuts.ts) binds Cmd+Z, Cmd+Shift+Z, Cmd+A, Tab, Enter, Esc, plus the tool shortcuts. It does NOT bind Cmd+D for "duplicate selected path."

grep -n 'duplicate\|DUPLICATE' src/components/editor/useKeyboardShortcuts.ts returns 0 matches. The hook doesn't have a duplicate binding.

The editor's path operations are exposed only via:

  • Right panel buttons (Add Node, Delete — no Duplicate)
  • Right-click context menu (none — per #191)
  • Keyboard shortcuts (no duplicate)

A user who:

  • Draws a leaf path
  • Wants to mirror + duplicate it 5 times for a flower
  • Realizes the editor has no path duplicate at all (per #187)

...and now has no shortcut to bind to a custom key.

Where

  • Keyboard hook: src/components/editor/useKeyboardShortcuts.ts
  • No duplicate binding: grep -n 'duplicate' src/components/editor/useKeyboardShortcuts.ts returns 0
  • Path duplicate: doesn't exist (#187)
  • Workspace duplicate: doesn't exist (#200)
  • The Workspace's context menu shows "Duplicate" with "Ctrl+D" hint but Ctrl+D doesn't fire because #200 hasn't landed either

Suggested fix shape

Once #187 and #200 are landed, add to the editor's keyboard hook:

// Cmd+D — duplicate the selected path
if ((e.metaKey || e.ctrlKey) && e.key === 'd' && !e.shiftKey) {
  e.preventDefault();
  onDuplicateSelectedPath();
  return;
}

onDuplicateSelectedPath is the same handler from #187. The hook should:

  • Not fire when a text input is focused (per the existing target instanceof HTMLInputElement check)
  • Not fire when the user is mid-rename

The hint "(Cmd+D)" should appear in:

  • The right panel's "Path Properties" section (if Duplicate is added there)
  • The right-click context menu (per #191)
  • The Help page (per #178)

Severity

Medium. Duplicate is a common operation; the user wants the keyboard shortcut once the affordance exists.

Discovered by

Gap analysis (2026-10-02) of editor keyboard shortcuts.

  • #187 (open) — Editor duplicate path (the affordance).
  • #200 (open) — Workspace duplicate object (the parallel affordance).
  • #191 (open) — Editor right-click context menu (the discoverable surface).
  • #176 (open) — Workspace's context menu shows shortcut hints that don't work. Adding the binding here would close that loop.
## Finding `src/components/editor/Editor.tsx`'s keyboard shortcuts hook (`useKeyboardShortcuts.ts`) binds Cmd+Z, Cmd+Shift+Z, Cmd+A, Tab, Enter, Esc, plus the tool shortcuts. It does NOT bind Cmd+D for "duplicate selected path." `grep -n 'duplicate\|DUPLICATE' src/components/editor/useKeyboardShortcuts.ts` returns 0 matches. The hook doesn't have a duplicate binding. The editor's path operations are exposed only via: - Right panel buttons (Add Node, Delete — no Duplicate) - Right-click context menu (none — per #191) - Keyboard shortcuts (no duplicate) A user who: - Draws a leaf path - Wants to mirror + duplicate it 5 times for a flower - Realizes the editor has no path duplicate at all (per #187) ...and now has no shortcut to bind to a custom key. ## Where - Keyboard hook: `src/components/editor/useKeyboardShortcuts.ts` - No duplicate binding: `grep -n 'duplicate' src/components/editor/useKeyboardShortcuts.ts` returns 0 - Path duplicate: doesn't exist (#187) - Workspace duplicate: doesn't exist (#200) - The Workspace's context menu shows "Duplicate" with "Ctrl+D" hint but Ctrl+D doesn't fire because #200 hasn't landed either ## Suggested fix shape Once #187 and #200 are landed, add to the editor's keyboard hook: ```ts // Cmd+D — duplicate the selected path if ((e.metaKey || e.ctrlKey) && e.key === 'd' && !e.shiftKey) { e.preventDefault(); onDuplicateSelectedPath(); return; } ``` `onDuplicateSelectedPath` is the same handler from #187. The hook should: - Not fire when a text input is focused (per the existing `target instanceof HTMLInputElement` check) - Not fire when the user is mid-rename The hint "(Cmd+D)" should appear in: - The right panel's "Path Properties" section (if Duplicate is added there) - The right-click context menu (per #191) - The Help page (per #178) ## Severity Medium. Duplicate is a common operation; the user wants the keyboard shortcut once the affordance exists. ## Discovered by Gap analysis (2026-10-02) of editor keyboard shortcuts. ## Related - #187 (open) — Editor duplicate path (the affordance). - #200 (open) — Workspace duplicate object (the parallel affordance). - #191 (open) — Editor right-click context menu (the discoverable surface). - #176 (open) — Workspace's context menu shows shortcut hints that don't work. Adding the binding here would close that loop.
Author
Owner

Shipped in commit 094755f on origin/main.

  • Cmd/Ctrl+D now fires onDuplicateSelectedPath (#187), the same handler the right-panel Duplicate Path button (#187) and right-click context menu (#191) already invoke — so all three call paths share one implementation.
  • Hook no-ops when no path is selected (matches the disabled state of the right-panel button).
  • Cmd+Shift+D deliberately not bound (reserved for future duplicate-with-offset extension); Alt+Cmd+D deliberately not bound (browser/system bookmark chord).
  • Cmd+D inside an input element falls through to the existing focus skip-list — Cmd+D while renaming a path triggers the browser bookmark dialog, not a duplicate.

Also closed #176 — the Workspace's "Duplicate" context-menu hint (Ctrl+D) now works because the Workspace hook already bound Ctrl+D and the Editor hook now matches it.

Discoverable surfaces:

  • Right-panel Duplicate Path button title: "Clone this path (offset by 10mm). Undoable via Ctrl+Z. Shortcut: Cmd+D / Ctrl+D."
  • Right-click context menu Duplicate Path item: shows "Cmd+D" hint
  • Help page Editor Shortcuts grid: "Cmd + D — Duplicate selected path"

Tests: 9 new cases in useKeyboardShortcuts.test.ts (Cmd+D, Ctrl+D, no-selection guard, plain-D fallthrough to delete-node tool, modifier guards, focus skip-list, no interference with Cmd+A). All 1051 tests pass; tsc, lint, and build clean.

Shipped in commit 094755f on origin/main. - Cmd/Ctrl+D now fires `onDuplicateSelectedPath` (#187), the same handler the right-panel Duplicate Path button (#187) and right-click context menu (#191) already invoke — so all three call paths share one implementation. - Hook no-ops when no path is selected (matches the disabled state of the right-panel button). - Cmd+Shift+D deliberately not bound (reserved for future duplicate-with-offset extension); Alt+Cmd+D deliberately not bound (browser/system bookmark chord). - Cmd+D inside an input element falls through to the existing focus skip-list — Cmd+D while renaming a path triggers the browser bookmark dialog, not a duplicate. Also closed #176 — the Workspace's "Duplicate" context-menu hint (Ctrl+D) now works because the Workspace hook already bound Ctrl+D and the Editor hook now matches it. Discoverable surfaces: - Right-panel Duplicate Path button title: "Clone this path (offset by 10mm). Undoable via Ctrl+Z. Shortcut: Cmd+D / Ctrl+D." - Right-click context menu Duplicate Path item: shows "Cmd+D" hint - Help page Editor Shortcuts grid: "Cmd + D — Duplicate selected path" Tests: 9 new cases in useKeyboardShortcuts.test.ts (Cmd+D, Ctrl+D, no-selection guard, plain-D fallthrough to delete-node tool, modifier guards, focus skip-list, no interference with Cmd+A). All 1051 tests pass; tsc, lint, and build clean.
Mark closed this issue 2026-10-04 04:00:46 +00:00
Sign in to join this conversation.
No description provided.