Skip to content

F4: shared column drag, keyboard reorder and global removal (#25) - #74

Merged
DavidVFitzGerald merged 7 commits into
mainfrom
feat/f4-column-operations
Nov 15, 2026
Merged

DavidVFitzGerald merged 7 commits into
mainfrom
feat/f4-column-operations

Conversation

@DavidVFitzGerald

Copy link
Copy Markdown
Owner

Refs #25

F4-06, Phase 1 (frontend with mock services). Process headers can now be dragged, reordered from the keyboard and removed. Every operation goes through the shared SelectionStore (move, deselect), so the headers, both tabs, the grid and the Selected list always show one order. No PRD or spec change, so no ADR.

Behaviour

  • Pointer drag (ProcessHeaders, shared with Scores [Task] F5 — Assemble windowed Scores with valid and unavailable cell states #28)
    • A press becomes a drag only after 8 px of travel, so click, focus and hover behave as before. The × is never a drag handle.
    • An overlay follows the pointer, and an outline marks the landing column. The drop index comes from the pointer and the strip geometry, so off-screen (unmounted) columns can be targets.
    • Releasing over a column calls store.move exactly once. Escape, a release outside the strip, or a release over the column's own position changes nothing. Focus stays on the moved header.
    • Near either end of the strip (12% of its width), the strip scrolls every frame, up to 24 px. The grid keeps the cells in sync. The component scrolls the strip itself because, in a grid, the strip has overflow: hidden, and dnd-kit's auto-scroller only scrolls user-scrollable ancestors (commit 7d4235a).
  • Keyboard reorder
    • Space or Enter picks up the focused header.
    • While it is picked up, Left and Right arrows move it one position, and Home/End move it to either end. Each step scrolls the header into view and keeps focus on it.
    • Space or Enter drops it. Escape restores its position from before the pick-up. Moving focus away drops it where it is.
    • When nothing is picked up, the existing Arrow/Home/End focus movement is unchanged.
    • The controls are in services/README.md and in every header's accessible description.
  • Header ×
    • A real <button>, shown on hover and :focus-within. It is absolutely positioned and its space is always reserved, so the header size never changes.
    • Its accessible name is Remove column <name — geo>, disambiguated through the same helper as the Selected list (uniqueSelectionLabels, refactored out of SelectedProcesses). It never matches Remove … from selection.
    • Only the active header's × is tabbable, which adds one stop.
    • Activation deselects the process globally. Focus moves to the next header, else the previous one, else the tab's empty-state heading (data-empty-focus), never the body.
  • Announcements: pick-up, "position n of N" moves, drop, cancel and "Removed … from selection" go to one polite live region (app/announcer.ts). It is mounted in the UID-keyed workspace, so it survives the headers unmounting and is discarded on signout. dnd-kit's own assertive region is kept silent.

Library choice

@dnd-kit/core 6.3.1, pinned exactly in package.json and committed in package-lock.json.

  • License: MIT. Its transitive packages are @dnd-kit/accessibility 3.1.1 and @dnd-kit/utilities 3.2.2 (both MIT), and tslib (0BSD), which is now a runtime dependency.
  • React 19: its peer range is react/react-dom >=16.8.0.
  • Age: published 2024-12-05, well over two weeks ago.
  • Maintained: the project is active. @dnd-kit/react 0.5.3 was released 2026-10-31, but it is pre-1.0. Core 6.x is the stable line.
  • What it provides: pointer sensors with activation constraints, Escape cancel, click suppression after a drag, and DragOverlay.
  • Why not @dnd-kit/sortable: it measures item rects to compute targets, which breaks with virtualized columns that are not mounted. The drop target is computed from the strip geometry instead.
  • Keyboard reorder is index-based rather than dnd-kit's geometric KeyboardSensor. That works for unmounted off-screen positions and is testable in jsdom.
  • Installation: installed in the container with npm --prefix apps/frontend install --save-exact @dnd-kit/[email protected]. npm audit --omit=dev reports 0 vulnerabilities. The 7 moderate findings are in the existing typescript-eslint dev dependencies.

Tests

  • comparison-headers.test.tsx (6 new tests):
    • × name, button and tab stop, and button keys that don't reorder.
    • Removal focus: next, then previous, then empty state, with announcements.
    • Keyboard pick-up, move, boundary, Escape, Enter and blur-drop.
    • Pointer drag: click and sub-threshold presses, the drop indicator, one move on drop, Escape, outside and in-place drops.
    • One order in both tabs (AC3).
    • F3 append rules after manual changes (AC4).
    • One existing exact description assertion now expects the instructions appended. It is stricter, not weaker.
  • New flows-grid-columns.test.tsx (6 large-workload tests, limit 12):
    • AC6: keyboard and pointer reorders, plus cancel and in-place/outside drops, cause no row, summary or header reads. They show no aria-busy, no "Updating…", and no query is removed or invalidated. Tiles are read only for uncached compositions with the same token, values are identical, and keys are unique.
    • AC5: off-screen End reorder (strip and body scrolled, focus kept, ≤ 20 headers mounted); the active column removed (single tab stop on the same flow in the next column); × removal while deep (±1 px, only the anchor flow ever on top).
    • AC7 O2 and O1: × removal through the Flows grid: Retry after a row-page error during a selection update loses the anchored flow #69 hold.
  • New e2e/column-operations.spec.ts (Chromium, 3 tests):
    • Default scenario: drag with alignment and unchanged values, × hover/focus visibility without a size change, Escape, Flows → Scores → Flows, keyboard reorder with a focus ring, and × by pointer and by keyboard. Selected list, tree checkbox and focus all match, including the empty state.
    • Large scenario: an edge auto-scroll drag to position ≥ 30, and an off-screen keyboard reorder.
  • Changed locators and waits:
    • e2e/process-headers.spec.ts: the header tab-stop count is scoped to [role="group"], plus a check of one tabbable ×. Without the scope, the new × makes the count ambiguous.
    • flows-grid.test.tsx: one waitFor ("sizes mixed-sign rows…", deep scroll to row 300) used the implicit 1 s timeout. With the new large file running in parallel it timed out in 3 of 3 full runs. It passes alone, and it failed the same way with the original ProcessHeaders, so the cause is load, not rendering cost. It now uses the 10 s that the file's other deep-scroll waits already use. The assertion is unchanged, and the heap limit, pool and skips are unchanged. Flagged for PM/QA.

Commands (workspace container lca-diff-f4-columns, run as docker compose --project-directory . -f compose.yaml exec -T workspace bash -lc 'cd /workspaces/lca-diff && …')

Command Result
npm --prefix apps/frontend ci exit 0 (frozen)
npm --prefix apps/frontend run format:check All matched files use Prettier code style
npm --prefix apps/frontend run lint exit 0, 0 warnings
npm --prefix apps/frontend run typecheck exit 0
npm --prefix apps/frontend run test:unit 31 files, 403 tests passed
npm --prefix apps/frontend run build built
npm --prefix apps/frontend run test:e2e -- --project=chromium 29 passed (1.3 min), including all smoke specs and the 3 new ones

Measured times of the new large tests (full parallel run):

  • 7.5 s, 4.5 s, 19.3 s, 12.4 s, 11.6 s and 6.4 s.
  • The active-column and deep tests use the 40 s per-test override, as the existing deep tests do. The others run under the describe's 20 s budget.

New e2e times: 2.5 s, 10.2 s (auto-scroll) and 3.7 s.

Limitations

🤖 Generated with Claude Code

DavidVFitzGerald and others added 7 commits November 15, 2026 14:29
MIT-licensed, React >=16.8 peer range (React 19 compatible), published
2024-12-05 and pinned exactly. Installed in the workspace container; the
lockfile adds only @dnd-kit/accessibility, @dnd-kit/utilities and makes
tslib a runtime dependency.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Headers change only the shared SelectionStore: a dnd-kit pointer drag
(8 px activation, pointer edge auto-scroll, Escape cancels, outside drops
nothing) moves once on drop; Space/Enter picks a header up for arrow,
Home and End moves with Escape restoring the order; the × deselects the
process and moves focus to the next or previous header, or the tab's
empty state. Operations are announced in a workspace polite region.
Remove-button labels are shared with the Selected list (D4).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
In a grid the strip has overflow hidden (it follows the cells), so
dnd-kit's auto-scroller, which only scrolls user-scrollable ancestors,
never moved it. Scroll the strip each frame near either end instead; the
grid keeps the cells in sync.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…25)

flows-grid-columns.test.tsx (6 large-workload tests): order-only reads
for UI reorders, off-screen keyboard reorder, active and deep column
removal, and × removal through the #69 paused hold (O2) and first-page
error (O1). column-operations.spec.ts covers drag, keyboard, × and tab
parity in Chromium, plus edge auto-scroll in the large scenario. The
header tab-stop locator in process-headers.spec.ts is scoped to groups,
since each active header now also has a tabbable ×.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… (Refs #25)

With flows-grid-columns.test.tsx running in parallel, the implicit 1 s
waitFor timed out (3 of 3 full runs; the test passes alone and with the
original ProcessHeaders under the same load). The assertion is unchanged;
the file's other deep-scroll waits already use 10 s.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@DavidVFitzGerald
DavidVFitzGerald merged commit 0a8bc4b into main Nov 15, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant