Skip to content

feat(board): move cards to any column with digit keys and drag & drop#3522

Merged
Sayt-0 merged 2 commits into
docker:mainfrom
dgageot:worktree-board-b453f86fbf35bb0e
Jul 8, 2026
Merged

feat(board): move cards to any column with digit keys and drag & drop#3522
Sayt-0 merged 2 commits into
docker:mainfrom
dgageot:worktree-board-b453f86fbf35bb0e

Conversation

@dgageot

@dgageot dgageot commented Jul 8, 2026

Copy link
Copy Markdown
Member

The Kanban board previously only let you step a card one column at a time with [ and ]. For boards with many columns this is tedious, and there was no way to reposition a card at all without a keyboard.

This PR adds two complementary shortcuts. Pressing a digit key 1–9 moves the selected card directly to that column number (MoveTo binding), while [/] continue to do single-step moves. Moving a card forward still triggers the destination column's prompt via the existing App.MoveCard engine path, so the workflow is unchanged. For mouse users, pressing on a card and dragging it over another column highlights that column's border in green and shows a "Release to move the card to <column>" hint in the footer; releasing the button completes the move. Drops on the origin column or outside the board are no-ops, and motion jitter within the pressed cell is treated as a click rather than a drag.

A second commit hardens the edge cases surfaced during review: drag state is cleared whenever a dialog opens or a key is pressed, and it is re-validated on every board refresh so a swallowed mouse-release cannot leave stale state that fires on a later click. The drop resolves the target by card ID rather than position, so a refresh mid-drag cannot move the wrong card. Non-left-button releases are ignored, and renderFooter bounds-checks the drop-target column index before accessing it.

dgageot added 2 commits July 8, 2026 08:26
Reset drag on dialog open, key press, and stale-card refresh so a
swallowed mouse-release can never silently move a card later. Drop
resolves the card by ID (moveCard) rather than by current selection,
bounds-check dragCol in renderFooter, ignore non-left releases, and
suppress jitter-within-card so double-click attach still works.

Assisted-By: Claude
@dgageot dgageot requested a review from a team as a code owner July 8, 2026 06:48

@docker-agent docker-agent left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assessment: 🟢 APPROVE

Reviewed the drag-and-drop + digit-key card move implementation across pkg/board/tui/tui.go, pkg/board/tui/view.go, pkg/board/tui/dialogs.go, and pkg/board/tui/tui_test.go.

Summary: The implementation is sound. Key design decisions were validated:

  • moveCard bounds-checks dst (dst < 0 || dst >= len(m.columns)) — digit 1–9 and drag releases outside columns are safe no-ops.
  • Drag state invariant holds: m.dragging = true is only set in handleMotion when m.dragCardID != "" (guarded at line 745), so handleRelease can never call moveCard with an empty card ID.
  • msg.String()[0] in MoveTo is safe: bubbletea guarantees a single-character string for single-character key bindings, and the path is only reached after key.Matches succeeds for one of "1"–"9".
  • Drag state cleared correctly on dialog open, key press, and board refresh — the re-validation in reload() catches any swallowed mouse-release.
  • Drop resolves by card ID, not position — a refresh mid-drag cannot redirect to the wrong card.
  • renderFooter bounds-checks m.dragCol before indexing m.columns.
  • Non-left-button releases ignored in handleRelease (line 767).

No bugs introduced by this PR were found.

@aheritier aheritier added area/docs Documentation changes area/tui For features/issues/fixes related to the TUI kind/feat PR adds a new feature (maps to feat:). Use on PRs only. labels Jul 8, 2026
@Sayt-0 Sayt-0 merged commit 3209cc5 into docker:main Jul 8, 2026
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/docs Documentation changes area/tui For features/issues/fixes related to the TUI kind/feat PR adds a new feature (maps to feat:). Use on PRs only.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants