Kanban: cards cannot be moved between columns via drag-and-drop #45
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_whiteboard#45
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Kanban cards cannot be moved between columns (or reordered within a column) by dragging. The only way to change a card's column today is via the 3-dot menu -> "Move to X", which is slow and hidden.
Expected behavior (Miro/Trello/Jira-style): grab a card with the mouse and drop it into another column, or reorder it within the same column.
Evidence
In
crates/hero_whiteboard_ui/static/web/js/whiteboard/kanban.js:renderCard()(line 218) creates plainKonva.Rect+Konva.Textwith nodraggable: true.showCardMenu()at line 315.Proposed Fix
cancelBubbleso parent kanban group drag is not triggered.dragstart, lift the card to the top so it renders above other columns.dragmove, optionally highlight the target column under the pointer.dragend:Acceptance
Implementation Spec for Issue #45
Objective
Enable Miro/Trello/Jira-style drag-and-drop of kanban cards across and within columns while preserving existing board-drag, inline edit, and 3-dot-menu "Move to X" behavior.
Requirements
WhiteboardHistory/WhiteboardSync/refreshProperties.Files to Modify
crates/hero_whiteboard_ui/static/web/js/whiteboard/kanban.js— makecardRectindividually draggable insiderenderCard(), adddragstart/dragendhandlers that compute target(colIdx, insertIdx)from the pointer in the group's local coordinate space, splice the card withingroup._kanbanState.columns, then re-render / commit history / sync.Implementation Plan
Step 1: Make kanban cards draggable between columns and within a column
Files:
crates/hero_whiteboard_ui/static/web/js/whiteboard/kanban.jsSubtasks:
renderCard(), setdraggable: trueon thecardRectKonva.Rect only.cardText,menuHit,menuBtnremain non-draggable siblings; the parentgroupstays draggable for whole-board movement.cardRect.on('dragstart'):e.cancelBubble = true,WhiteboardHistory.snapshotBefore(group.id()),cardRect.moveToTop(), record source(colIdx, cardIdx).cardRect.on('dragend'):stage.getPointerPosition(), convert to group-local viagroup.getAbsoluteTransform().copy().invert().point(pointer).renderColumn:padding + colIdx*(colW+padding)..+ colW, requirelocal.y >= headerH.cy + 28 + i*(cardH+cardGap) + cardH/2.renderKanban(group)to snap back; no history/sync.renderKanban,refreshProperties,WhiteboardHistory.commitUpdate,WhiteboardSync.onUpdate.dblclickinline edit intact; keep menuHit handlers intact; keep hover effects.Acceptance Criteria
Notes
padding=8,headerH=36,cardGap=6,DEFAULT_COL_W=200,DEFAULT_CARD_H=44. Readstate.colWidth/state.cardHeightlive.group._kanbanStateis the single source of truth; every mutation → renderKanban + sync + history.renderCard().Test Results
cargo check --workspace: PASScargo clippy --workspace -- -D warnings: PASS (0 warnings)cargo fmt --all -- --check: PASScargo test --workspace --lib: PASS (0 passed; 0 failed — no crate defines library unit tests)No regressions introduced. Change is JavaScript-only (
crates/hero_whiteboard_ui/static/web/js/whiteboard/kanban.js), so the Rust CI gates act purely as a no-regression guard here. Interactive behavior needs manual smoke testing in the browser.Implementation Summary
Changes
crates/hero_whiteboard_ui/static/web/js/whiteboard/kanban.js— inrenderCard():draggable: trueon the card's Konva.Rect (card background only — text, menu-hit overlay, and menu dots stay non-draggable; the parent kanban group remains draggable for whole-board movement).dragstarthandler: cancels event bubbling, takes a history snapshot viaWhiteboardHistory.snapshotBefore, and callsmoveToTop()so the grabbed card floats over its neighbors during the gesture.dragendhandler:renderColumn) and requires the pointer to be below the header band.renderKanbanwithout mutating state; clears the pending snapshot with a no-opcommitUpdate.WhiteboardSync.onUpdate.What still works
snapshotBefore/commitUpdatewhich useserializeForServer, so the full column state is restored._kanbanState.columnsis what the server stores, so reordering persists.Test Results
cargo check --workspace: PASScargo clippy --workspace -- -D warnings: PASScargo fmt --all -- --check: PASScargo test --workspace --lib: PASSNotes
e.cancelBubble = trueondragstartis a belt-and-braces.Pull request opened: #46
This PR implements the changes discussed in this issue.