Editor has no way to cycle between paths — Tab cycles nodes within a path, but with 5+ paths the user can only reach other paths by clicking in the right panel #194

Closed
opened 2026-10-03 23:48:37 +00:00 by Mark · 1 comment
Owner

Finding

src/pages/Editor.tsx's handleTab (line 845) cycles nodes within the currently selected path:

const path = paths.find((p) => p.id === selectedPathId) ?? paths[0];
const nodes = path.nodes;
const nextIndex = (tabIndex + 1) % nodes.length;
setSelectedNodeIds([nodes[nextIndex].id]);
setSelectedPathId(path.id);

There's no parallel handler for cycling between paths. The user with 5 paths in a design:

  • Tabs through the 12 nodes of path 1
  • Wants to move to path 2
  • Has to scroll to the right panel, click on path 2's row

grep -n 'nextPath\|prevPath\|cycle.*path' src/ returns 0 hits. No such handler exists.

Where

  • Editor: src/pages/Editor.tsx:845 (Tab = nodes within a path)
  • No path cycle: src/pages/Editor.tsx (no handler)
  • Right panel path list: src/components/editor/EditorRightPanel.tsx:142-180 (click to select a path)
  • No keyboard shortcut hook: src/components/editor/useKeyboardShortcuts.ts (no path cycle binding)

Suggested fix shape

Add two keybindings to useKeyboardShortcuts.ts:

  • Alt+] (or Page Down) → next path
  • Alt+[ (or Page Up) → previous path

The handlers find the current path's index in paths, advance by 1 (modulo length), set selectedPathId and setSelectedNodeIds([]).

const handleCyclePath = useCallback((delta: 1 | -1) => {
  const currentIndex = paths.findIndex((p) => p.id === selectedPathId);
  if (currentIndex === -1 && paths.length === 0) return;
  const nextIndex = (currentIndex + delta + paths.length) % paths.length;
  setSelectedPathId(paths[nextIndex].id);
  setSelectedNodeIds([]);
}, [paths, selectedPathId]);

The handler should also reset tabIndex so the next Tab press starts at node 0 of the new path.

Severity

Low. The user can click in the right panel. Power users with many paths feel the friction.

Discovered by

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

  • #178 (open) — Help page documents zero editor shortcuts. Path cycle is a shortcut the Help page should describe.
  • #188 (open) — Editor multi-path selection. The cycle vs multi-select are competing models.
## Finding `src/pages/Editor.tsx`'s `handleTab` (line 845) cycles nodes within the currently selected path: ```ts const path = paths.find((p) => p.id === selectedPathId) ?? paths[0]; const nodes = path.nodes; const nextIndex = (tabIndex + 1) % nodes.length; setSelectedNodeIds([nodes[nextIndex].id]); setSelectedPathId(path.id); ``` There's no parallel handler for cycling between paths. The user with 5 paths in a design: - Tabs through the 12 nodes of path 1 - Wants to move to path 2 - Has to scroll to the right panel, click on path 2's row `grep -n 'nextPath\|prevPath\|cycle.*path' src/` returns 0 hits. No such handler exists. ## Where - Editor: `src/pages/Editor.tsx:845` (Tab = nodes within a path) - No path cycle: `src/pages/Editor.tsx` (no handler) - Right panel path list: `src/components/editor/EditorRightPanel.tsx:142-180` (click to select a path) - No keyboard shortcut hook: `src/components/editor/useKeyboardShortcuts.ts` (no path cycle binding) ## Suggested fix shape Add two keybindings to `useKeyboardShortcuts.ts`: - `Alt+]` (or `Page Down`) → next path - `Alt+[` (or `Page Up`) → previous path The handlers find the current path's index in `paths`, advance by 1 (modulo length), set `selectedPathId` and `setSelectedNodeIds([])`. ```ts const handleCyclePath = useCallback((delta: 1 | -1) => { const currentIndex = paths.findIndex((p) => p.id === selectedPathId); if (currentIndex === -1 && paths.length === 0) return; const nextIndex = (currentIndex + delta + paths.length) % paths.length; setSelectedPathId(paths[nextIndex].id); setSelectedNodeIds([]); }, [paths, selectedPathId]); ``` The handler should also reset `tabIndex` so the next Tab press starts at node 0 of the new path. ## Severity Low. The user can click in the right panel. Power users with many paths feel the friction. ## Discovered by Gap analysis (2026-10-02) of editor keyboard navigation. ## Related - #178 (open) — Help page documents zero editor shortcuts. Path cycle is a shortcut the Help page should describe. - #188 (open) — Editor multi-path selection. The cycle vs multi-select are competing models.
Author
Owner

Implemented in 15922cd).

Add Alt+] / Alt+[ to cycle between paths in the Editor. handleCyclePath in Editor.tsx advances the selected path by +1/-1 (mod length) and clears the stale tabIndex so Tab on the new path starts at node 0. The hook requires onCyclePath and dispatches it for plain Alt (no Ctrl/Cmd/Shift) on ] or [ so we don't swallow browser/system chords like Ctrl+] (forward) or Cmd+[ (back).

Help.tsx mirrors the binding list.

8 new regression tests in src/components/editor/useKeyboardShortcuts.test.ts cover the happy path, the modifier guard, the input-focus skip-list, and that the existing Tab binding still fires.

Local gates: tsc -b clean, eslint clean, vitest 888 passing (1 skipped).

Implemented in 15922cd). Add Alt+] / Alt+[ to cycle between paths in the Editor. handleCyclePath in Editor.tsx advances the selected path by +1/-1 (mod length) and clears the stale tabIndex so Tab on the new path starts at node 0. The hook requires onCyclePath and dispatches it for plain Alt (no Ctrl/Cmd/Shift) on ] or [ so we don't swallow browser/system chords like Ctrl+] (forward) or Cmd+[ (back). Help.tsx mirrors the binding list. 8 new regression tests in src/components/editor/useKeyboardShortcuts.test.ts cover the happy path, the modifier guard, the input-focus skip-list, and that the existing Tab binding still fires. Local gates: tsc -b clean, eslint clean, vitest 888 passing (1 skipped).
Mark closed this issue 2026-10-04 01:02:09 +00:00
Sign in to join this conversation.
No description provided.