Skip to content

Fix column drag indicator direction#879

Merged
revolist merged 3 commits into
mainfrom
issue-755-column-drag-indicator
Jun 2, 2026
Merged

Fix column drag indicator direction#879
revolist merged 3 commits into
mainfrom
issue-755-column-drag-indicator

Conversation

@revolist

@revolist revolist commented May 27, 2026

Copy link
Copy Markdown
Owner

Summary

  • fix the column drag placement indicator for right-to-left header moves
  • add an e2e regression that verifies the indicator appears at the actual insertion edge before drop

Root Cause

The column move plugin always rendered the indicator at the hovered column end edge, while the drop logic inserts before the hovered column when dragging from right to left.

Validation

  • npm test -- --runInBand
  • npm run build
  • prettier --check e2e/reordering.spec.ts src/plugins/moveColumn/column.drag.plugin.ts
  • direct Playwright browser check against built www for left-to-right and right-to-left drag indicator placement

Fixes #755

Summary by CodeRabbit

  • Bug Fixes

    • Improved column drag-and-drop behavior: more accurate insertion positioning (including RTL), dropping onto the same column preserves order, and accidental header clicks are suppressed immediately after a drag.
  • Tests

    • Added end-to-end coverage for column reordering: verifies position indicators during drags (including RTL), confirms same-column drop is a no-op, and checks post-drag header-click suppression.

@coderabbitai

coderabbitai Bot commented May 27, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

Pull request was closed or merged during review

Walkthrough

Refactors column-drag insertion-edge logic into getColumnDragPosition, adds header-click suppression after drag, adjusts drag-end dispatch/reorder flow, and updates/extends Playwright e2e tests to validate same-column drops and right-to-left placement indicator alignment.

Changes

Column Drag Insertion-Edge Fix & E2E Tests

Layer / File(s) Summary
Header-click suppression state & listener
src/plugins/moveColumn/column.drag.plugin.ts
Adds columnDragMoved and preventNextHeaderClick, a capture-phase beforeheaderclick handler to suppress post-drag header clicks, wires/reset points at drag start/end, and removes the listener during cleanup.
Drag start viewport and item offset formatting
src/plugins/moveColumn/column.drag.plugin.ts
Refactors dragStart viewport scrollEl lookup and startItem computation into clearer multi-line expressions used when initiating a drag.
Move handling, drag end flow, and position helper
src/plugins/moveColumn/column.drag.plugin.ts
Introduces exported getColumnDragPosition(...), updates doMove/showHandler to use it, and updates onMouseUp to dispatch BEFORE_COLUMN_DRAG_END_EVENT, conditionally reorder/persist columns, dispatch COLUMN_DRAG_END_EVENT, apply header-click suppression, and clear drag state.
Playwright reordering tests and new coverage
e2e/reordering.spec.ts
Refactors initial mouse move coordinates to use boundingBox-derived centers for row/header drags; adds tests: (1) drag sortable header and drop on same column asserting no sort/data change including after click; (2) right-to-left header drag that polls .drag-position-y boundingBox.x alignment and asserts final header order.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • revolist/revogrid#852: Both PRs modify column reordering behavior and related e2e tests across src/plugins/moveColumn/column.drag.plugin.ts and e2e/reordering.spec.ts.

Poem

🐰 I nudged a header, left then right,
The indicator settled into sight—
No phantom clicks to spoil the fun,
Columns line up, neat and done.
twitches whiskers

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Fix column drag indicator direction' directly addresses the main change: fixing the column drag placement indicator for right-to-left header moves, which is the primary objective.
Linked Issues check ✅ Passed The PR successfully addresses issue #755 by fixing the column drag indicator position for right-to-left moves through refactored drop position logic and adds regression test coverage.
Out of Scope Changes check ✅ Passed All changes are scoped to fixing the column drag indicator and adding related regression tests; no unrelated modifications were introduced.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue-755-column-drag-indicator

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sonarqubecloud

sonarqubecloud Bot commented Jun 2, 2026

Copy link
Copy Markdown

@revolist revolist merged commit 3fee3b6 into main Jun 2, 2026
7 of 8 checks passed
@revolist revolist deleted the issue-755-column-drag-indicator branch June 2, 2026 14:06
@revolist revolist added the feature New feature or request label Jun 2, 2026
@revolist revolist self-assigned this Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Placement indicator in wrong spot when moving column

2 participants