Skip to content

feat: reorder columns by dragging or from a menu - #27

Merged
SyedSibtainRazvi merged 3 commits into
mainfrom
feat/column-reordering
Nov 27, 2026
Merged

SyedSibtainRazvi merged 3 commits into
mainfrom
feat/column-reordering

Conversation

@SyedSibtainRazvi

Copy link
Copy Markdown
Contributor

Etiquettes of raising a PR

PR reviews are a way to request peers to give feedback on the code that is going
to the mainline. This means, that PR should be in a reviewable state. Please ensure
that the following checkboxes are ticked. If any of them are not ticked, then
the PR is not ready for review

  • Did you test changes locally?
  • Did you check PR contents after opening the PR

Related issue

Functionalities added or changed

  • <Sheet enableColumnOrdering />, off by default. Each movable header gets a grip, shown on hover or focus and always on touch screens:
    • Drag it onto another header. The column lands before or after it, by the half it's dropped on, and a 2 px accent line shows where. Escape cancels.
    • Click it, or press Enter, for a menu that moves the column one place left or right. It works from the keyboard, on touch screens and with screen readers. Focus stays on the grip, and the new position is announced.
  • Rules:
    • meta: { enableColumnOrdering: false } keeps a column where it is, and others move around it.
    • A column stays in its group, and a column outside a group moves past a whole group.
    • Hidden columns keep their places.
    • The order is TanStack's columnOrder, so it saves and loads like any TanStack state.
  • Playground: the sorting demo, with Title fixed first, and the grouped 1,000-row demo.
  • Docs: a README section with labels and API, plus architecture.md and decisions.md.

Additional info

  • From TanStack's docs:
    • the columnOrder state and setColumnOrder
    • the browser's own drag events, the column ordering guide's suggestion for no dependencies, with Material React Table as its reference
  • From other sources, or ours: the guide covers none of the following. decisions.md ("Moving columns") gives each one's source.
    • the menu, required by WCAG 2.2's dragging movements criterion, and following Chrome's drag-and-drop guide and Atlassian's guidelines
    • left and right on screen, as Chrome's guide and MUI X do
    • keeping columns in their group, as MUI X does
    • off by default, the "stays put" rule, and moving on drop (ours)
  • Not breaking.
    • meta stays untyped: typing it through the sheet's feature set stopped apps' interface-typed meta values from compiling.
    • When the prop is on, Sheet renders a live region beside the table, because the table may hold only rows.
  • Tests:
    • 167 unit tests pass, with the move rules tested on their own.
    • All 46 e2e tests pass, axe scans included. The new ones cover:
      • dragging left and right, and a drop from another sheet being refused
      • Escape cancelling a drag
      • the menu, focus and the announcement
      • fixed columns and groups
      • right to left
      • the grip on touch screens, and its 24 px target
    • Locally, the new e2e tests also pass in Playwright's Firefox and WebKit, and five times in a row in Chromium.
  • Not verified: a real Safari, real touch devices, screen reader output, and edge scrolling during a drag outside Chromium.

Checklist

  • Tests
  • Translations
  • Documentation
  • Uploaded screenshots
  • Verified on preview url once

Screenshots

Page(s) if applicable

To follow.

Sheet's enableColumnOrdering gives each movable header a grip. Drag it onto another header, or click it for a menu that moves the column one place left or right, which works from the keyboard, on touch screens and with screen readers. The new position is announced. A column with meta: { enableColumnOrdering: false } stays put, a column stays in its group, and the order is TanStack's columnOrder.
@SyedSibtainRazvi SyedSibtainRazvi self-assigned this Nov 26, 2026
Base automatically changed from feat/resize-off-render to main November 27, 2026 06:27
@SyedSibtainRazvi
SyedSibtainRazvi merged commit 9dfd39f into main Nov 27, 2026
1 check passed
@SyedSibtainRazvi
SyedSibtainRazvi deleted the feat/column-reordering branch November 27, 2026 06:31
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