Commit 608b8c8
committed
Favorites: fix dead drag-reorder, dead ⌥↑/⌥↓ reorder, and rename keystroke leak
Three interactive bugs in the editable-favorites switcher, all found in real-mouse QA, all in `VolumeBreadcrumb.svelte`:
- **Drag-to-reorder did nothing.** The reorder was built on HTML5 `draggable`/`ondragstart`/`ondrop`, whose events never fire under Tauri's `dragDropEnabled` (macOS intercepts drag gestures at the OS layer before the WKWebView sees them). Reimplemented as a self-contained pointer-drag: `onmousedown` arms `window` `mousemove`/`mouseup` listeners, a reorder begins only past a small move threshold (below it a mouseup is a plain click → navigate), and the live insertion slot (computed from each row's `getBoundingClientRect` midpoint via the new pure `pointerReorderTarget`) drives the existing drop-line cue. This mirrors why the native file-list drag is `onmousedown`-based, not `draggable`. The grabbed-row `is-dragging` style and reduced-motion are honored; favorite rows route navigation through mouseup (skipping `onclick`) so a click still works.
- **Keyboard reorder (⌥↑ / ⌥↓) did nothing.** The dropdown navigates by a virtual `highlightedIndex` and rows aren't DOM-focused, so the per-item `onkeydown` never fired and `handleDropdownKey` ate the bare arrows first. Moved the Alt-arrow handling into the exported `handleKeyDown`, before `handleDropdownKey`, acting on the highlighted favorite and following the moved item so repeated ⌥↓ keeps moving it. Removed the dead per-item keydown path (and the now-unused `tabindex`/`role="button"`/HTML5-drag attrs on the rows).
- **Space leaked from the rename textbox to the pane** (selected the file under the cursor). `handleRenameKeyDown` only stopped propagation for Enter/Escape; now it `stopPropagation()`s every key, since the focused rename `<input>` owns its keystrokes and the pane's raw Space-selection DOM listener isn't covered by the dispatch-level guard.
Tests: extended the pure `favorites-reorder` helper tests for `pointerReorderTarget`, added `handleKeyDown` Alt-arrow reorder cases (move / top-edge no-op / non-favorite ignored), a rename-input all-keys-stop-propagation test, and updated the pre-existing `pane/volume-breadcrumb.test.ts` favorite tests to the pointer-based shape. Docs: rewrote the `navigation/CLAUDE.md` reorder must-know and `DETAILS.md` to record the Tauri/WKWebView HTML5-DnD-is-dead gotcha so nobody reintroduces HTML5 drag.1 parent d3db386 commit 608b8c8
7 files changed
Lines changed: 342 additions & 102 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
48 | 57 | | |
49 | 58 | | |
Lines changed: 29 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
228 | 228 | | |
229 | 229 | | |
230 | 230 | | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
245 | 260 | | |
246 | 261 | | |
247 | 262 | | |
| |||
0 commit comments