fix(choices): show the drag pill as soon as a touch drag starts - #2137
Conversation
svelte-dnd-action turns its drag clone into the pill only once the zone renders the shadow item, which stripShadow leaves out. A touch drag starts after the long-press without moving, so until the finger moved the whole dragged row was drawn over the next one. The choice list, macro builder and template folder list now make the pill when the drag starts. Fixes #2136
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (5)
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review. 📝 WalkthroughWalkthroughThe change adds shared drag-start handling that transforms drag clones into labeled pills. Choice, command, and folder lists call the helper with their label resolvers. An end-to-end test checks touch dragging and preserves choice order. ChangesDrag pill rendering
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Low Merge Risk: ⚪ Minimal · up to This change shows the drag pill as soon as a touch drag starts in the three lists. The impact is visual only, and no merge-blocking risk is evident. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. A rabbit holds a paw quite still, Comment |
Summary
On a phone, long-pressing a choice drew the whole dragged row over the row below it until the finger moved (#2136). svelte-dnd-action calls
transformDraggedElement(which makes the pill) only when the zone renders the shadow item, and the zones strip it atDRAG_STARTED(#1244, #883, #1692). A mouse drag moves at once; a touch drag starts after the 200 ms long-press without moving, so the full-row clone stayed over the next row.showDragPillOnStart(indndReorder.ts) turns the clone into the pill onDRAG_STARTED, with the zone's own label. The choice list, macro builder command list and template folder list call it from their consider handler; the folder list's label function is now shared between the two places that need it.Older than 2.30: 2.29.0 does the same on the phone.
Testing
Reproduced on an iPhone (iOS 18.7, Obsidian 1.14.3) on 2.29.0 and the 2.30 candidate: screen recording frame. With this branch on the phone, a long-press shows the pill at once and the row below stays clean:
tests/e2e/drag-pill-touch.test.ts: arms the handle, holds a touch on a choice row for 400 ms without moving, and checks the clone is the pill with the choice's name, then that the hold-and-release kept every choice ([BUG] Drag-and-drop deletes choices on Android #1692). It fails on master ({ pill: false, label: null }).tests/e2e/drag-pill-bounds.test.tspasses.tests/e2e/choice-list-layout.test.ts"opens the New choice menu under its button" fails in my local instance on master and on this branch alike, before any drag code runs.pnpm run test: 6607 passed, 33 skipped.pnpm run check,pnpm run build-with-lint: clean.Release impact
Visual only, all platforms (a mouse drag gets the pill one move earlier). No settings or data change.
Fixes #2136
Note
Show drag pill immediately on touch drag start in choice lists
Adds
showDragPillOnStartin dndReorder.ts to convert the drag clone into a labeled drag pill as soon as the drag-start trigger fires, instead of waiting for first movement. Applies it to the choice, command, and folder drag handlers in ChoiceList.svelte, CommandList.svelte, and FolderList.svelte.nameLabelutility used by the drag-zone options and the pill helper.Macroscope summarized 332e13b.
Summary by CodeRabbit