Repository navigation
feat(lab): reorder Table columns by keyboard and by taps - #14018
humbertovirtudes wants to merge 2 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
There was a problem hiding this comment.
Approval waits on an engineering owner's spec decision, and four fixes are needed.
No current spec makes Table an adopting collection of the reorderable spec (AST-103), or defines useTableDragAndDropColumns, its columnKeys input and its Lab-local inline-axis engine. The description lists these as owner decisions, and the Lab exemption does not apply because the pull request also changes Core's catalog and Storybook. An engineering owner records the decision by commenting /approve-spec <full head SHA> on this pull request, or points to the spec that should govern it; the author may approve, as an engineering owner.
Blocking:
- The hint's move buttons set no
position, so their touch bands anchor to the hint surface, and a finger tap just outside a move glyph lands on Done instead of moving the column (useTableDragAndDropColumns.tsx:185, AST-094 FR42). - The hint, its buttons,
boundsOfandmessagesFromcopy Core'srenderAnchoredHint, reorderHintButton,boundsOfandmessagesFrom, and have already drifted (no fade-in, no positioned button), so export Core's versions through@astryxdesign/core/internal/reorderand reuse them. reorder.commit()runs from two layout Effects on each table commit, and the second pass reads layout right after the first pass's style writes, which forces a second synchronous layout update per move; write the configuration before layout Effects run and commit once.reorderable.start(key)never reaches this plugin, so an app's "Move column" action enters no reorder mode (AST-103 FR4a).
Claims and files checked
Review mode: full; reason: no-earlier-review
- Claim: columns reorder by keyboard and by taps. Verified.
- Claim: Table has no column reorder today. Reported.
- Claim: this ships reorder mode only, and the drag comes later. Verified.
- Claim: a move reports the column's key and its index among the listed columns, and a kept column stays in place. Verified.
- Claim: with column settings, the active columns own the order, and unlisted columns get no handle. Verified.
- Claim: the handle is a named toggle in the header overlay, and the header keeps its own name. Verified.
- Claim: the handle sits at the start or the end, with an adaptive reveal. Verified in the code; the reveal opacity is reported.
- Claim: Space or Enter starts the mode, Left and Right move one place (mirrored in right-to-left), each move reports once, focus stays on the handle, and the column scrolls into view. Verified; Space and the scroll come from the author's browser run.
- Claim: the hint's Move left, Move right and Done buttons let a tap reorder. Verified for a tap on a glyph; the coarse-pointer targets are broken (blocking).
- Claim: Escape, Done or the handle again end the mode. Verified.
- Claim: a line marks the edge the column came in through. Verified in the code; the browser run is reported.
- Claim: a kept end column bounds the moves and is announced by name. Verified.
- Claim: each move is announced once after it renders, and Done announces the final place. Verified.
- Claim: places count every listed column, and unmounted neighbours are named. Verified.
- Claim: Core adds the Move left and Move right messages with a chore changeset, and apps see no change. Verified.
- Claim: Core's reorder engine moves only along the block axis. Verified.
- Claim: the plugin shares Core's strings, announcer, layer, dismissal, reveal and touch hit area. Verified as imports; the hint surface is a copy (blocking).
- Claim: the Testing table's results (unit, mutation, browser, typecheck and build, suites, lint, repository checks, size, pre-review). Reported; typecheck and lint pass in CI on this head, and the authored line count is verified.
- Claim: the scope checklist. Verified.
- File:
.changeset/list-reorder-move-left-right.md. Clear. - File:
apps/storybook/stories/TableDragAndDropColumns.stories.tsx. Clear. - File:
packages/core/locales/en.json. Clear. - File:
packages/lab/src/TableDragAndDrop/__tests__/TableDragAndDropColumns.a11y.chromium.spec.ts. Clear (not run). - File:
packages/lab/src/TableDragAndDrop/columnReorder.ts. CopiedboundsOf; double layout pass. - File:
packages/lab/src/TableDragAndDrop/useTableDragAndDropColumns.doc.mjs. Clear. - File:
packages/lab/src/TableDragAndDrop/useTableDragAndDropColumns.test.tsx. Clear (not run). - File:
packages/lab/src/TableDragAndDrop/useTableDragAndDropColumns.tsx. Touch targets, copied hint, double layout pass,start(key), two notes. - File:
packages/lab/src/index.ts. Clear.
| backgroundColor: 'transparent', | ||
| color: colorVars['--color-icon-secondary'], | ||
| cursor: { | ||
| default: 'grab', |
There was a problem hiding this comment.
Non-blocking: this pull request has no drag, so a grab cursor invites a drag that does nothing. Keep the default cursor until the drag lands.
| }); | ||
| reorder.commit(); | ||
| }); | ||
| // Ends reorder mode in progress as the plugin goes. |
There was a problem hiding this comment.
Non-blocking (INV29): dispose() cancels the pending move and hides the line, but leaves the mode set. Suggested: "Cancels a pending move and hides the line when the plugin unmounts."
9a23fc3 to
b8fb4a8
Compare
There was a problem hiding this comment.
Approval waits on an engineering owner's spec decision, and six fixes are needed.
No current spec makes Table an adopting collection of the reorderable spec (AST-103), or defines useTableDragAndDropColumns, its columnKeys input and its Lab-local inline-axis engine; the description lists these as owner decisions, and the Lab exemption does not apply because the pull request also changes Core's catalog, Storybook and a CLI test sample. An engineering owner records the decision by commenting /approve-spec <full head SHA> on this pull request, or points to the spec that should govern it; the author may do so as an engineering owner.
Blocking:
- The hint's move buttons set no
position, so their touch bands anchor to the hint and a finger tap just outside a move glyph lands on Done instead of moving the column (useTableDragAndDropColumns.tsx:185, AST-094 FR42). - Miss:
useAnnounce()runs in the hook's caller (useTableDragAndDropColumns.tsx:477), so when the Table sits in a Dialog that the same component renders, every move and Done announcement goes to the page's live region behind the modal and is not heard; call it inColumnReorderHostinstead (AST-103 FR4, AST-086 FR14). - Miss: after a move from the hint nothing returns focus to the handle (
columnReorder.ts:190-208,:316-334), so a screen reader that moved focus onto Move right is left there and the next arrow press moves nothing (AST-103 FR4). - The hint, its buttons,
boundsOfandmessagesFromcopy Core'srenderAnchoredHint, reorderHintButton,boundsOfandmessagesFromand have already drifted (no fade-in, no positioned button, no focus return), so export Core's versions through@astryxdesign/core/internal/reorderand reuse them. reorderable.start(key)never reaches this plugin, so an app's Move column action enters no reorder mode (AST-103 FR4a).reorder.commit()runs from two layout Effects on each table commit, and the second pass reads layout right after the first pass's style writes, which forces a second synchronous layout per move; write the configuration before layout Effects run and commit once.
Claims and files checked
Review mode: full; reason: history
- Claim: columns reorder by keyboard and by taps. Verified.
- Claim: Table has no column reorder today. Reported.
- Claim: this ships reorder mode only, and the drag comes later. Verified.
- Claim: a move reports the column's key and its index among the listed columns, and a kept column stays in place. Verified.
- Claim: with column settings, the active columns own the order, and unlisted columns get no handle. Verified.
- Claim: the handle is a named toggle in the header overlay, and the header keeps its own name. Verified.
- Claim: the handle sits at the start or the end, with an adaptive reveal and List's handle sizes. Verified in the code; the reveal opacity is reported.
- Claim: Space or Enter starts the mode, Left and Right move one place (mirrored in right-to-left), each move reports once, and the column scrolls into view. Verified.
- Claim: the focus stays on the handle on each move. False when a screen reader has moved focus into the hint (blocking).
- Claim: the hint's Move left, Move right and Done buttons let a tap reorder. Verified; the coarse-pointer targets are broken (blocking).
- Claim: Escape, Done or the handle again end the mode. Verified.
- Claim: a line marks the edge the column came in through. Verified in the code.
- Claim: a kept end column bounds the moves and is announced by name. Verified.
- Claim: each move is announced once after it renders, and Done announces the final place. Verified outside a modal; false inside a modal the hook's caller renders (blocking).
- Claim: places count every listed column under windowing, and unmounted neighbours are named. Verified.
- Claim: Core adds the Move left and Move right messages with a chore changeset, and apps see no change. Verified.
- Claim: Core's reorder engine moves only along the block axis. Verified.
- Claim: the plugin shares Core's strings, announcer, layer, dismissal, reveal and touch hit area. Verified as imports; the hint surface is a copy (blocking).
- Claim: the Testing table's results. Reported.
- Claim: the scope checklist. Verified.
- File:
.changeset/list-reorder-move-left-right.md. Clear. - File:
apps/storybook/stories/TableDragAndDropColumns.stories.tsx. Clear. - File:
packages/cli/test/swizzle-proof/samples.mjs. Clear. - File:
packages/core/locales/en.json. Clear; the key namespace waits on the owner decision. - File:
packages/lab/src/TableDragAndDrop/__tests__/TableDragAndDropColumns.a11y.chromium.spec.ts. Clear (not run). - File:
packages/lab/src/TableDragAndDrop/columnReorder.ts. Focus after a hint move, copiedboundsOf, double layout pass. - File:
packages/lab/src/TableDragAndDrop/useTableDragAndDropColumns.doc.mjs. Clear. - File:
packages/lab/src/TableDragAndDrop/useTableDragAndDropColumns.test.tsx. Clear (not run). - File:
packages/lab/src/TableDragAndDrop/useTableDragAndDropColumns.tsx. Touch targets, modal announcements, copied hint,start(key), double layout pass, three notes. - File:
packages/lab/src/index.ts. Clear.
b8fb4a8 to
86a4af8
Compare
There was a problem hiding this comment.
This pull request is reviewed as part of its stack; see the review on #14020.
86a4af8 to
9696e0c
Compare
There was a problem hiding this comment.
This pull request is reviewed as part of its stack; see the review on #14020.
9696e0c to
f422d75
Compare
There was a problem hiding this comment.
This pull request is reviewed as part of its stack; see the review on #14020.
f422d75 to
9e64be6
Compare
There was a problem hiding this comment.
This pull request is reviewed as part of its stack; see the review on #14020.
9e64be6 to
bf634c2
Compare
There was a problem hiding this comment.
This pull request is reviewed as part of its stack; see the review on #14020.
…st's reorder parts A new internal entry, @astryxdesign/core/internal/reorder-mode, gives Lab the parts of List's reorder: the mode hint, which now offers Up and Down or Left and Right, the strings, the pointer input with a finger's hold, the edge autoscroll, the drop bounds and the preview copy. internal/reorder gains mountReorderStarter, so a reorderable object's start(key) reaches such a collection. List's session uses the same parts, so List does not change. The catalog gains Move left and Move right.
useTableDragAndDropColumns puts a reorder handle in the header cell of each column in columnKeys. The handle turns on reorder mode: Left and Right move the column one place at a time, mirrored in right-to-left, and List's mode hint offers the moves and Done as buttons. Each move reports once, and announces the column's place with List's reorder strings after it lands. The reorderable's handle option places the handle and reveals it, and its start(key) turns on the mode from the app's own action.
bf634c2 to
42fbcb1
Compare
There was a problem hiding this comment.
This pull request is reviewed as part of its stack; see the review on #14020.
Part of #3639 and #3956 (drag-and-drop Table columns).
Stack: #14028 → #14018 → #14019 → #14020
The first commit is #14028. Review the last commit,
feat(lab): reorder Table columns by keyboard and by taps.User need
People reorder a table's columns to put the ones they compare side by side, for example after they show a column with column settings. A keyboard or screen-reader user needs to do that without a drag, and so does a pointer or finger user who cannot drag (WCAG 2.5.7). Today a Table has no column reorder.
Design
useTableDragAndDropColumns({reorderable, columnKeys})in Lab returns a Table plugin. This pull request ships its reorder mode; #14019 adds the drag.createReorderableobject (spec:AST-103FR8):onReorder({key, to})reports the column's key and its index after the move amongcolumnKeys, andisReorderable(key)keeps a column in place. The object'sstart(key)turns on reorder mode for a column from the app's own action, such as a "Move column" menu item (FR4a), through feat(core): a Lab collection that runs its own reorder mode shares List's reorder parts #14028'smountReorderStarter.columnKeyslists the columns people can reorder, in their order. With column settings, passuseTableColumnSettingsState'sactiveColumnKeysand apply the move to them: a hidden column keeps its place in the settings. A column outsidecolumnKeys, such as the selection column, gets no handle and does not count.getNodeText(feat(core): a Lab collection that runs its own reorder mode shares List's reorder parts #14028) as Table's resize handle reads it. It sits in the header cell's overlay slot, so the column header keeps its own name. The reorderable'shandleoption places it (AST-103 FR1): at the cell's end by default, or at its start, clear of a resize boundary. WithrevealBehavior: 'adaptive', it shows while its header cell is hovered or holds the focus where the pointer is fine, through Core'suseContainerReveal. Its grip and target reuse List's reorder handle sizes. A kept column gets no handle, and its header stays as it is, with no room kept for one: the plugin finds header cells by Table'sdata-column-key.ReorderModeHint, inline axis) offers Move left, Move right and Done as buttons, so a tap reorders too. Escape, Done or the handle again ends the mode. An insertion line marks the edge the column came in through (design:ordered-collection-reorderingDR7). A kept column at either end bounds the moves, through List'smovableRange("Can't move past Task").reorderMessagesFrom): "Owner, position 3 of 5, after Status, before Due" and "Done, Owner at position 4 of 5". Places count every column incolumnKeys, so column windowing does not change them, and an unmounted neighbour is named by its header text.Owner decisions
reorderable.attachcould later take an inline axis and serve Table columns from Core.useTableDragAndDropColumns,UseTableDragAndDropColumnsConfig, and an explicitcolumnKeys. Lab is not a stable public promise.Testing
vitest --project ui packages/lab/src/TableDragAndDropreorderable.start('owner')focuses Owner's handle in reorder mode, and Right then moves itTableDragAndDropColumns.a11y.chromium.spec.tstypecheck;pnpm build; Storybook buildvitest --project ui packages/core packages/labeslint --max-warnings=0(strict), Prettierpnpm check:repo(knowledge, changesets, i18n runtime and catalog, sync), changeset coverage,scripts/shared-identity.test.mjs(7/7)check:component-import-boundaries --base-ref origin/main;pnpm size:pages --base origin/mainpnpm review:pre --base#14028's branchlab__useTableDragAndDropColumnssample (without it the hook's render fails)Scope
Components: Table, useTableDragAndDropColumns