Skip to content

feat(reorderable): attach reorders plain elements by keyboard - #11226

Open
cixzhang wants to merge 21 commits into
mainfrom
l0/reorderable-attach
Open

cixzhang wants to merge 21 commits into
mainfrom
l0/reorderable-attach

Conversation

@cixzhang

@cixzhang cixzhang commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Keyboard only. This is step 2a of spec:AST-103 FR4b. Attached handles get reorder mode, the hint, announcements and start(key). Pointer and touch drags of attached handles arrive in the next step (2b). RichText's block move builds on both.

User impact

  • Who: people using an app that renders its own elements (not an Astryx List), such as a card stack or an editor's blocks, with a keyboard or a screen reader.
  • Before: createReorderable reordered only Astryx collections, so an app with its own elements had to build its own reorder handle, keyboard model and announcements, or go without.
  • After: reorderable.attach(container, {items}) turns each item's handle into the same reorder toggle List rows have:
    • the handle is in the Tab order and named "Reorder" plus the item's name;
    • Space or Enter turns reorder mode on, Up and Down move the item, and Escape or Done ends it;
    • screen readers hear each move with its place and neighbours;
    • a move the app does not apply is refused and announced ("Can't move King of hearts");
    • start(key) reaches attached items;
    • detach() removes everything attach added.

Spec

  • spec:AST-103 FR4b (attach), FR4 (reorder mode), FR4a (start), and FR1's notMoved label.
  • Specs rulings on this design: the hint is List's own hint in an owned React root, mounted at first use; announcements go through the shared channel, or the dialog's own region inside a modal; a move counts when items() reports it by the end of the task that ran onReorder; there is no mutation watching; and the owned elements go in the nearest enclosing dialog, else the nearest theme scope.

Changes

  • reorderable/attachReorderable.ts (new, internal):
    • wires handles: role, aria-pressed, name, Tab stop, description, and the private handle mark;
    • reads items() at attach, at each press, key or start, and after each move;
    • registers every row's name, keyless and fixed rows included, so refusals and a neighbour's announcement name them;
    • puts its owned elements in the nearest dialog, else the nearest [data-astryx-theme], else body: hidden instructions and a fixed, sizeless hint host, with the hint itself in the top layer. A container that is itself a dialog holds them, so a modal one leaves the hint usable; any other container gains no element (the search starts at its parent), and its parent gains them only when it is that dialog, theme scope or body;
    • adds the insertion-line style at first mode entry, and detach removes it. The shared reorder engine sets position: relative on a static container at each mode entry and restores it when the mode ends.
  • createReorderable.ts: the attach method and its types (ReorderableItem, ReorderableAttachOptions, ReorderableAttachment). The types are not exported from the package root.
  • List/listReorderEngine.tsx: exports mountSession, messagesFrom and ListReorderModeHint for attach. ReorderMessages gains an optional notMoved, which the end-of-task fallback announces instead of the unchanged place. keyDown takes the key-event fields it reads, so native events work. List passes no notMoved, so its announcements are unchanged; it shares the engine's landing by key with attach.
  • privateAttributes/listReorder.stylex.ts: markReorderHandle, so the attribute's name stays in its owner module.
  • internal/reorder.ts: Lab's adapted objects delegate attach to the owner's.
  • en.json: @astryx.list.reorderNotMoved ("Can't move {label}"), records-decided by FR1's notMoved label, and @astryx.list.reorderHintKeyboard, the attached handles' description ("Press Space or Enter, then the arrow keys to move this item one place at a time. Press Escape when you are done."). It names no drag, because attached handles start none yet; List keeps its own hint.
  • AST-103: FR4b's gap now covers drags, the keyboard-only description, and moves by Up and Down only; one sentence on where owned elements go and when items() is read; the later-added-item gap; the verification row names the unit tests and the new key; verified_by lists the new tests.
  • Docs and story: createReorderable.doc.mjs documents attach. A new story, Core/createReorderable "Attach plain elements", shows a React app rendering a plain <ol>.
  • Changeset: [feat] patch.

Evidence

  • Unit tests (attachReorderable.test.ts, 33 pass, red on main because attach does not exist):
    • a move the app applies synchronously, in a microtask (a React flush), never, or in a later task: exactly one announcement each, "Can't move …" for the last two;
    • Escape, the hint's buttons, start(key), and an isReorderable end row ("Can't move past Pinned");
    • an item added later and wired at the next press;
    • a keyless row named by its text in a neighbour's announcement ("after Note", not "after Item 1"; red before the fix);
    • a flex and a grid parent keeping exactly their children;
    • detach restoring every attribute and removing every owned element;
    • a container that is itself a dialog holding the owned elements, and one that is itself a theme scope gaining none.
  • Browser spec (ReorderableAttachMode.interaction.browser.spec.ts): Tab order and names, Space and Enter, arrow moves applied with setState and announced, the hint's Move down and Done, Escape, start(key), and the list holding only its <li>s. It runs on CI's browser legs.
  • First load (pnpm size:pages --base main --page list=List --unused-on table,menu,list, main 8a5008a against this head's merge): docs +0 B, form +0 B, menu +110 B gzip, table +108 B gzip; a List page without reorderable +0 B. Each page without the feature passes INV10's 307 B limit.
  • Regression: at 4432e83, the List, reorderable, internal, and Lab TransferList and ListInput suites run 361 tests in 25 files, all passing.
  • Core and Storybook tsc, eslint, check:knowledge, check:i18n-catalog and check:i18n-runtime.

Known and queued

Queued as follow-ups, outside this change:

  • Rename timing: a self-handle's announced name lags one read after a rename during reorder mode.
  • Description restore: detach writes back the handle's description as it was at attach, not as the app last set it.
  • Docs: the createReorderable doc still calls start(key) "its one method".
  • Self-handle keys: an item that is its own handle takes Space and Enter typed into controls inside it; the handle should take them only when the event targets the handle itself.
  • Other windows: a container in a same-origin iframe or Picture-in-Picture window gets no wiring and no warning (element checks bound to this window).

Writing rubric results

Run over the AST-103 edits (FR4b paragraph, verification row, front matter).

  • R1 narration: none.
  • R2 research in the record: none.
  • R3 evidence naming a change: none. The verification row names test files.
  • R4 rejected alternatives over one line or outside a decision: none.
  • R5 pull request or issue references remaining: none.
  • R6 ruled open questions still listing options: none.
  • R7 project status in the record: the gap lines state what is not built in the existing "Implementation gap" form.

(Posted by Cindy's agent on her behalf.)

Owner: Astryx fix-loop lane 0. Land path: Held as a draft for an owner decision on AST-103 FR4b. Then CodeBunny approval, Specs stamp, CI, and the merge queue. If the decision goes the other way, this closes with that reason.

createReorderable objects gain attach(container, {items}): each handle
becomes a named reorder mode toggle in the Tab order, with List's arrow
moves, hint, announcements and Escape, and start(key) reaches attached
items. A move counts when items() reports it by the end of the task that
ran onReorder; otherwise it is refused and announced with the new
@astryx.list.reorderNotMoved message. The elements attach owns sit in the
nearest theme scope, and detach removes everything it added. Pointer and
touch drags of attached handles come next.
@vercel

vercel Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 25, 2026 6:47pm UTC

Request Review

@astracat-bot

astracat-bot Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 25, 2026, 6:54 PM UTC

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 11, 2026
@github-actions github-actions Bot added the needs:design-review Affects visuals — Design should review label Nov 11, 2026
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 11, 2026
@cixzhang cixzhang added ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) ci:run-a11y Run the accessibility suite on this PR; write access, next push (AST-030 FR12) labels Nov 11, 2026
@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 044385a

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
lab/AudioPlayer 243.0 kB (+159 B) · 1.8 kB CSS (0) — — · — · —
lab/VideoPlayer 240.8 kB (+149 B) · 2.1 kB CSS (0) — — · — · —
lab/Comments 395.2 kB (+131 B) · 2.5 kB CSS (0) — — · — · —
27 more components
Component Size LoC Visual · A11y · RTL
lab/MediaFullscreenButton 232.9 kB (+129 B) · 1.5 kB CSS (0) — — · — · —
lab/MediaPlaybackRate 232.9 kB (+129 B) · 1.5 kB CSS (0) — — · — · —
lab/MediaPlayButton 232.9 kB (+129 B) · 1.5 kB CSS (0) — — · — · —
lab/MediaSeekButton 232.9 kB (+129 B) · 1.5 kB CSS (0) — — · — · —
lab/MediaVolume 232.9 kB (+127 B) · 1.5 kB CSS (0) — — · — · —
lab/CommentThread 388.4 kB (+125 B) · 2.4 kB CSS (0) — — · — · —
lab/MediaCaptionsButton 232.9 kB (+124 B) · 1.5 kB CSS (0) — — · — · —
lab/MediaTime 232.9 kB (+124 B) · 1.5 kB CSS (0) — — · — · —
lab/MediaTimeSlider 232.9 kB (+124 B) · 1.5 kB CSS (0) — — · — · —
MoreMenu 137.4 kB (+114 B) · 20.1 kB CSS (0) — — · — · —
SideNav 118.3 kB (+114 B) · 12.7 kB CSS (0) — — · — · —
TableHeaderCell 111.2 kB (+114 B) · 20.3 kB CSS (0) — — · — · —
TableCell 111.3 kB (+111 B) · 20.5 kB CSS (0) — — · — · —
DropdownMenu 137.2 kB (+110 B) · 20.1 kB CSS (0) — — · — · —
Markdown 214.5 kB (+106 B) · 23.8 kB CSS (0) — — · — · —
BreadcrumbItem 106.6 kB (+103 B) · 14.3 kB CSS (0) — — · — · —
Table 129.6 kB (+101 B) · 21.5 kB CSS (0) — — · — · —
ContextMenu 110.2 kB (+98 B) · 19.9 kB CSS (0) — — · — · —
DropdownMenuSubMenu 83.1 kB (+97 B) · 11.5 kB CSS (0) — — · — · —
lab/TransferList 143.4 kB (+28 B) · 1.4 kB CSS (0) — — · — · —
lab/TransferListSelector 155.7 kB (+23 B) · 1.6 kB CSS (0) — — · — · —
PowerSearch 323.3 kB (+22 B) · 27.6 kB CSS (0) — — · — · —
lab/ListInput 100.5 kB (+18 B) · 1.3 kB CSS (0) — — · — · —
lab/TabBarMoreList 107.7 kB (+16 B) · 1.8 kB CSS (0) — — · — · —
CheckboxList 78.4 kB (0) · 8.5 kB CSS (0) — — · — · —
List 20.5 kB (0) · 3.0 kB CSS (0) — ✓ · ✓ · —
ListItem 84.3 kB (0) · 13.0 kB CSS (0) — ✓ · ✓ · ✓

Package size: @astryxdesign/core 8.08 MB packed (+14.4 kB); no new dependencies.

API changes: core +1 · ~0 · −0

1 API change (advisory)
Package Where Signature Usage
+ core . · Types · interface Reorderable attach: (container: HTMLElement, options: { items: () => ReadonlyArray<{ readonly key: TKey; readonly element: HTMLElement; readonly handle: HTMLElement }> }) => { detach(): void } import type {Reorderable} from '@astryxdesign/core'; const x: Reorderable = {attach: …}

Touched components checked; for the full suite, add ci:run-visual for Visual.


Generated by PR Enrichment workflow | View full report

@astracat-bot astracat-bot Bot 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.

This pull request needs an engineering owner's spec decision and some changes before it can be approved.

Spec decision. The pull request adds two requirements to spec:AST-103 FR4b that the record on main does not state: where the elements attach owns sit (the nearest theme scope, else the document body), and when attach reads items() (with the new gap for items added later). An engineering owner records the decision by commenting /approve-spec <full head SHA> on the pull request; the author may do so if they are an engineering owner.

Changes needed

  • The story's inline ref callback (createReorderable.stories.tsx:95) attaches again on every render, so the first arrow move ends reorder mode without an announcement, and the browser spec's mode and announcement steps cannot pass.
  • Handles are named from the item's raw textContent, so the story's grips read "Reorder Ace of spades⋮⋮" and all five tests in ReorderableAttachMode.interaction.browser.spec.ts fail; reuse readAccessibleName from utils/accessibleName.ts with the handle's subtree left out, instead of the separate nameOf.
  • A move the app applies by re-rendering its rows is announced as "Can't move …", because the commit check compares element identity rather than reading the key at to from items().
  • A move applied in a microtask queued after attach's own check, still within the task, is announced as "Can't move …"; re-read items() in the next-task fallback before announcing notMoved.
  • In a horizontal or grid container, Left and Right do nothing and the hint offers only up and down, against FR4's axis rule; implement the axis or state the gap in FR4b and the docs.
  • After reorder mode, detach leaves an inline position: relative on a static container, because prepareMode saves the engine's own relative as the original value; drop that copy and let the engine own the positioning.

Automated review (maintainer link)

Comment thread docs/specs/AST-103-reorderable/spec.md Resolved
@cixzhang
cixzhang marked this pull request as ready for review November 11, 2026 13:17
…-rendered and later moves, and states the axis gap

- Items are named with readAccessibleName, the handle's subtree left out.
- A move lands when the moved key is at its new place, so a re-rendered
  row commits; the end-of-task fallback reads the items again first, so a
  later microtask in the same task commits.
- The story attaches once (a stable ref callback).
- detach no longer leaves an inline position: the controller owns it.
- AST-103 FR4b states the vertical-axis gap and names the List engine
  entries attach reuses.
@cixzhang
cixzhang marked this pull request as draft November 11, 2026 14:16
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec ffab19b

@cixzhang

Copy link
Copy Markdown
Contributor Author

Decision: D-20261111-340

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 11, 2026

@astracat-bot astracat-bot Bot 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.

Changes requested. The spec:AST-103 edits are approved for this head and the first round's findings are fixed; five defects and one test gap remain.

  • Miss: inside a modal <dialog> the page opens, attach puts the hint outside the dialog (attachReorderable.ts:189-191, :343), where the browser makes it inert, so its Move up, Move down and Done buttons take no click or tap and a pointer or touch user cannot reorder there; put the owned elements in the enclosing open modal and amend FR4b's placement sentence to match.
  • detach unmounts the hint's React root synchronously (attachReorderable.ts:450), so a React app that detaches in a ref callback's cleanup, as the story does, logs React's "Attempted to synchronously unmount a root while React was already rendering" error once reorder mode has been used; defer the unmount.
  • Miss: an item whose handle is its own element gets a Reorder toggle that enters reorder mode, but the arrow keys move nothing, because the engine looks for a row's key only in handles below the row (listReorderEngine.tsx:940-953).
  • Miss: detach writes back the container's whole saved class attribute (attachReorderable.ts:329-334, :453), which undoes class changes the app made while attached; remove only the class tokens attach added.
  • Miss: isNativelyFocusable (attachReorderable.ts:105-114) re-declares the focusable elements that the shared FOCUSABLE_SELECTOR (hooks/focusableSelector.ts) owns and already differs from it; use the shared selector and delete the copy.
  • FR4b's verification row names states that attach builds but no test covers: a container in a page-opened modal dialog, one object attached to two containers, a keyless item, an item with no accessible name, a server import, and a handle with its own tabindex="-1".

The first fix changes an approved FR4b sentence, so the next head needs an engineering owner's /approve-spec again. Inline comments carry the non-blocking notes.

Automated review (maintainer link)

);
}

/** Puts back the handle attributes and the container style `attach` set. */

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.

Non-blocking (INV29): snapshot restores any listed attributes, and here the handle attributes and the container's class, not "the container style". Suggested rewrite: "Saves names on element; returns the restore."

… is its item, and restores only its own classes

- detach hides the hint's host at once and unmounts its React root after
  the task's synchronous work, so a React app may detach while it renders.
- The engine takes an attached item that is its own handle.
- detach removes only the class tokens attach added.
- The type names stay internal; attach is typed inline, so it is the
  only new public name.
- Tests cover a modal container, one object on two containers, a keyless
  item, an unnamed item, and a server import; a JSDoc block is back on
  its method.
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 11, 2026
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 254e4f4

@cixzhang

Copy link
Copy Markdown
Contributor Author

Decision: D-20261111-383

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 11, 2026
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec cdadef7

@astracat-bot astracat-bot Bot 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.

Changes requested: attach keeps a container that is itself a dialog or theme scope free of the elements it owns, but that leaves the hint unusable when the container is itself an open modal dialog, and one description claim is stale.

  • When the container is itself an open modal <dialog>, ownedParentOf() (attachReorderable.ts:212-215) puts the hint and its instructions outside it, so the modal makes the hint inert and a click or a tap on Move down moves nothing, against spec:AST-103 FR4's tappable hint and FR4b's own "so a modal dialog does not make them inert"; keep the owned elements in a container that is the open modal dialog and state that exception in FR4b and the description, or record the inert hint as an FR4b implementation gap.
  • The description's Evidence says attachReorderable.test.ts has 31 passing tests, but it has 32, and the case for a container that is itself a dialog or theme scope is not listed.

Either record change needs an engineering owner's /approve-spec at the new head. Everything else checks out against the approved FR4b, and the remaining notes are non-blocking.

Claims and files checked

Review mode: same-head; reason: none

  • Changed rules since the last review (0): none.
  • Changeset, attach reorders plain elements from items() (key, element, handle in order): verified (createReorderable.ts:93-116, unit tests).
  • Changeset, each handle becomes a reorder toggle named for its item: verified (attachReorderable.ts:305-393, unit tests, Chromium).
  • Changeset, Space or Enter starts, arrows move, Escape ends, each move is announced: verified, with Up and Down only as the same note says (unit tests, Chromium).
  • Changeset, an unapplied move is refused and announced: verified (unit tests for a move never applied and one applied a task later).
  • Changeset, start(key) reaches attached items and detach() removes what attach added: verified (unit tests).
  • Changeset, attached items move up and down and have no drag yet: verified (List's key handler; no drag wiring).
  • Description, handles are Tab stops named "Reorder" plus the item's name: verified (unit tests, Chromium).
  • Description, moves announce place and neighbours, and refusals name the item: verified (unit tests).
  • Description, the hint is List's own hint in an owned React root mounted at first use: verified (attachReorderable.ts:414-434).
  • Description, announcements use the shared channel, or the dialog's own region inside a modal: verified (attachReorderable.ts:219-230, unit test).
  • Description, a move counts when items() reports it by the end of the task, with no mutation watching: verified (attachReorderable.ts:448-473).
  • Description, items() is read at attach, at each press, key or start, and after each move: verified (sync calls and the controller hooks).
  • Description, every row's name is registered, keyless and fixed rows included: verified (unit test with a keyless neighbour).
  • Description, owned elements go in the nearest dialog, else theme scope, else body, and the container gains none: verified (attachReorderable.ts:212-215, unit test), but a container that is itself a modal dialog then gets an inert hint (blocking finding).
  • Description, the insertion-line class comes and goes with attach, and the engine sets and restores position: relative: verified (attachReorderable.ts:414-425, listReorderEngine.tsx:2143-2165).
  • Description, the new types are not exported from the package root: verified (index.ts:197-203; one added public row).
  • Description, engine exports, optional notMoved, narrower keyDown event type, List announcements unchanged, landing by key: verified (List suites pass).
  • Description, the handle mark lives in the private-attribute owner module, and Lab's adapted objects delegate attach: verified.
  • Description, two new catalog strings, the attached description naming no drag: verified (en.json).
  • Description, the record, doc entry, story and changeset edits as listed: verified.
  • Description, unit tests "31 pass": false, the file has 32 tests.
  • Description, unit tests fail on the base because attach does not exist there: verified (base createReorderable.ts).
  • Description, each listed unit-test case exists: verified.
  • Description, the browser spec's coverage and its CI legs: verified by reading; it did not run on CI at this head (draft).
  • Description, first-load deltas within the 307 B limit: consistent with an earlier measurement of this change (menu +121 B, table +109 B, other pages +0); nothing on those pages' import path changed since.
  • Description, the regression run at an earlier commit: stated for that commit; the same suites pass at this head.
  • Description, Core and Storybook typecheck, eslint, knowledge and i18n checks: verified at this head.
  • Description, known and queued follow-ups: still present as described.
  • .changeset/reorderable-attach-plain-elements.md: clear.
  • apps/storybook/stories/createReorderable.stories.tsx: clear.
  • docs/specs/AST-103-reorderable/spec.md: the placement sentence leaves a modal-dialog container's hint inert (blocking finding).
  • packages/core/locales/en.json: clear.
  • packages/core/src/List/listReorderContext.ts: clear.
  • packages/core/src/List/listReorderEngine.tsx: clear.
  • packages/core/src/internal/reorder.ts: clear.
  • packages/core/src/privateAttributes/listReorder.stylex.ts: clear.
  • packages/core/src/reorderable/__tests__/ReorderableAttachMode.interaction.browser.spec.ts: clear.
  • packages/core/src/reorderable/attachReorderable.server.test.ts: clear.
  • packages/core/src/reorderable/attachReorderable.test.ts: clear.
  • packages/core/src/reorderable/attachReorderable.ts: blocking finding at 212-215; non-blocking comment notes at 5-23 and 136.
  • packages/core/src/reorderable/createReorderable.doc.mjs: non-blocking, still calls start(key) "its one method" (line 44).
  • packages/core/src/reorderable/createReorderable.ts: clear.
  • packages/core/src/utils/accessibleName.ts: clear.

Automated review (maintainer link)

…and instructions, so a modal one leaves them usable
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 21, 2026
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 1929ed1

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 21, 2026

@astracat-bot astracat-bot Bot 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.

Approved pending CI: some of CI's test shards have not finished on this head, and the merge guard requires them green. reorderable.attach matches the reorderable spec's attach requirement and the edits an engineering owner approved for this head, and its new browser spec now passes in Chromium and WebKit.

Two non-blocking points:

  • Every click anywhere in the container re-reads items() and re-names every item (attachReorderable.ts:478); syncing only when the click lands in a handle would keep long lists cheap.
  • The description's land-path line still says the pull request is held as a draft for an owner decision, which is no longer true.
Claims and files checked

Review mode: same-head; reason: none

  • Changeset, attach(container, {items}) reorders plain elements from items() in order: verified (createReorderable.ts:103-116, unit tests).
  • Changeset, each handle becomes a reorder toggle named for its item: verified (unit tests; the browser spec finds "Reorder " on each grip).
  • Changeset, Space or Enter starts, the arrow keys move, Escape ends, and screen readers hear each move: verified, Up and Down only, as the same note says (unit tests; browser spec in Chromium and WebKit).
  • Changeset, a move not applied by the end of the task is refused and announced: verified (unit tests for a move never applied and one applied a task later).
  • Changeset, start(key) reaches attached items and detach() removes what attach added: verified (unit tests).
  • Changeset, attached items move up and down and have no drag yet: verified (only click, keydown and focusout listeners, attachReorderable.ts:511-513).
  • Description, before this change createReorderable reordered only collections: verified (the base object has no attach).
  • Description, handles are Tab stops named "Reorder" plus the item's name: verified (unit tests, browser spec).
  • Description, moves announce place and neighbours, and refusals name the item: verified (unit tests, browser spec).
  • Description, the hint is List's own hint in an owned React root mounted at first use: verified (attachReorderable.ts:416-438).
  • Description, announcements use the shared channel, or the dialog's own region inside a modal: verified (attachReorderable.ts:221-232, unit test).
  • Description, a move counts when items() reports it by the end of the task, with no mutation watching: verified (attachReorderable.ts:450-475; no observer in the module).
  • Description, items() is read at attach, at each press, key or start, and after each move: verified; it is also read on every other click in the container (non-blocking point above).
  • Description, every row's name is registered, keyless and fixed rows included: verified (unit test with a keyless neighbour).
  • Description, owned elements go in a container that is itself a dialog, else the nearest dialog, theme scope or body, and any other container gains none: verified (attachReorderable.ts:213-217, unit tests).
  • Description, the insertion-line class comes and goes with attach, and the engine sets and restores position: relative at each mode entry: verified (attachReorderable.ts:416-426, listReorderEngine.tsx:1066-1080, :2142-2164).
  • Description, the attach types are not exported from the package root: verified; they are declared in attachReorderable.ts, and the root exports only the factory, Reorderable, ReorderableOptions and ReorderMove.
  • Description, the engine exports, optional notMoved, narrower keyDown event type, List's unchanged announcements and landing by key: verified (List passes no notMoved; List suites pass).
  • Description, the handle mark lives in the private-attribute owner module, and Lab's adapted objects delegate attach: verified.
  • Description, two new catalog strings, the attached description naming no drag: verified (en.json:626, :646).
  • Description, the record, doc entry, story and changeset edits as listed: verified.
  • Description, 33 unit tests pass and fail on the base because attach does not exist there: verified (33 pass at this head; the base object has no attach).
  • Description, each listed unit-test case exists: verified.
  • Description, the browser spec's coverage and that it runs on CI's browser legs: verified (all five cases passed on this head in Chromium and WebKit).
  • Description, the first-load deltas stay within the 0.3 KB limit: verified (CI's size analysis on this head: List +0 B, menus about +110 B, Table +110 B).
  • Description, the regression run of 361 tests at an earlier commit: stated for that commit; the same suites run 363 tests at this head, all passing.
  • Description, Core and Storybook typecheck, eslint and the knowledge and i18n checks: verified by CI on this head (its typecheck job covers Core and Storybook, and its lint job runs eslint and the knowledge and i18n checks).
  • Description, the known and queued follow-ups: still present as described.
  • Description, the land-path line (held as a draft for an owner decision): out of date; a process note, not a claim about the code.
  • .changeset/reorderable-attach-plain-elements.md: clear.
  • apps/storybook/stories/createReorderable.stories.tsx: clear.
  • docs/specs/AST-103-reorderable/spec.md: clear.
  • packages/core/locales/en.json: clear.
  • packages/core/src/List/listReorderContext.ts: clear.
  • packages/core/src/List/listReorderEngine.tsx: clear.
  • packages/core/src/internal/reorder.ts: clear.
  • packages/core/src/privateAttributes/listReorder.stylex.ts: clear.
  • packages/core/src/reorderable/__tests__/ReorderableAttachMode.interaction.browser.spec.ts: clear.
  • packages/core/src/reorderable/attachReorderable.server.test.ts: clear.
  • packages/core/src/reorderable/attachReorderable.test.ts: clear.
  • packages/core/src/reorderable/attachReorderable.ts: non-blocking notes at 5-23, 136 and 478.
  • packages/core/src/reorderable/createReorderable.doc.mjs: non-blocking note at 44.
  • packages/core/src/reorderable/createReorderable.ts: clear.
  • packages/core/src/utils/accessibleName.ts: clear.

Automated review (maintainer link)

const unmount = mountSession(options.startedBy ?? options, controller);

const onClick = (event: MouseEvent) => {
sync();

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.

Miss, non-blocking: sync() runs before the handle check, so every click anywhere in the container re-reads items() and re-names every item. Naming deep-clones each item's element, twice for a wired handle (:254, :323). In an editor or a long card list, each click on content pays for that, though FR4b reads only "at each press … on a handle". Find the target in items()' handles first, and sync only when it is in one.

@cixzhang
cixzhang marked this pull request as ready for review November 21, 2026 16:47

@rubyycheung rubyycheung 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.

Design approval for keyboard reordering of plain elements. Compared the exact base and this head: Tab reaches the named handle; Space and Enter enter reorder mode; arrow moves apply with focus retained and position announcements; Escape keeps the move; the hint buttons and start(key) work. This approval covers the keyboard-only scope, not pointer/touch dragging or the documented naming, cleanup and secondary-window follow-ups. Verified in desktop Chromium, not full CI.

# Conflicts:
#	docs/specs/AST-103-reorderable/spec.md
#	packages/core/src/privateAttributes/listReorder.stylex.ts
#	packages/core/src/reorderable/createReorderable.doc.mjs
#	packages/core/src/reorderable/createReorderable.ts
#	packages/core/src/utils/accessibleName.ts
@cixzhang cixzhang added the ci:run-rtl Run the RTL suite on this PR; write access, next push (AST-030 FR12) label Nov 25, 2026
@cixzhang
cixzhang marked this pull request as draft November 25, 2026 18:12
@github-actions
github-actions Bot requested a review from rubyycheung November 25, 2026 18:13
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 25, 2026
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 2effe0e

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 25, 2026
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 044385a

@astracat-bot astracat-bot Bot 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.

Approved pending CI: CI has not run on this head yet, because the pull request is a draft, and the merge guard requires its checks green. reorderable.attach matches the reorderable spec's attach requirement and the edits an engineering owner approved for this head, and the new commit gives the reorder hint the container's direction in right-to-left layouts.

Non-blocking points:

  • Every click anywhere in the container re-reads items() and re-names every item (attachReorderable.ts:484-486); syncing only when the click lands in a handle keeps long lists cheap.
  • The new comment at attachReorderable.ts:438-440 is one long sentence with two topics; see the inline suggestion.
  • createReorderable.doc.mjs still calls start(key) "its one method" just before it documents attach.
Claims and files checked

Review mode: full; reason: merge-touches-pr-files

  • Changeset, attach(container, {items}) reorders plain elements without a collection component: verified (createReorderable.ts:130-143, :176-182; unit tests).
  • Changeset, items() returns each item's key, element and handle in order: verified (createReorderable.ts:133-139).
  • Changeset, each handle becomes a reorder mode toggle named for its item: verified (attachReorderable.ts:338-395; unit tests; the browser spec finds "Reorder ").
  • Changeset, Space or Enter starts, the arrow keys move, Escape ends, and screen readers hear each move: verified, Up and Down only, as the same note says (unit tests; browser spec).
  • Changeset, a move not applied by the end of the task is refused and announced: verified (unit tests for a move never applied and one applied a task later).
  • Changeset, start(key) reaches attached items: verified (attachReorderable.ts:154-166; unit test; browser spec).
  • Changeset, detach() removes everything attach added: verified (attachReorderable.ts:524-557; unit tests), apart from the queued description-restore follow-up.
  • Changeset, attached items move up and down, with no drag yet: verified (only click, key and focus-out listeners, attachReorderable.ts:517-519).
  • Description, before this change createReorderable reordered only collections: verified (the base object has no attach).
  • Description, handles are Tab stops named "Reorder" plus the item's name, with Space or Enter, Up and Down, Escape or Done: verified (unit tests, browser spec).
  • Description, moves announce place and neighbours, and a refused move names the item: verified (unit tests; en.json:646).
  • Description, the hint is List's own hint in an owned root mounted at first use: verified (attachReorderable.ts:416-437).
  • Description, announcements use the shared channel, or the dialog's own region inside a modal: verified (attachReorderable.ts:221-232; unit test).
  • Description, a move counts when items() reports it by the end of the task, with no mutation watching: verified (attachReorderable.ts:456-479; no observer in the module).
  • Description, items() is read at attach, at each press, key or start, and after each move: verified; it is also read on every other click in the container (non-blocking point above).
  • Description, every row's name is registered, keyless and fixed rows included: verified (attachReorderable.ts:245-263; unit test with a keyless neighbour).
  • Description, owned elements go in a container that is itself a dialog, else the nearest dialog, theme scope or body, and any other container gains none: verified (attachReorderable.ts:213-217; unit tests).
  • Description, the insertion-line class comes and goes with attach, and the engine sets and restores position: relative at each mode entry: verified (attachReorderable.ts:417-426; listReorderEngine.tsx:2221-2238).
  • Description, the attach types are not exported from the package root: verified (index.ts:198-204).
  • Description, the engine exports, optional notMoved, narrower keyDown event type, List's unchanged announcements and landing by key: verified (List passes no notMoved).
  • Description, the handle mark in the private-attribute module and Lab's delegation of attach: verified.
  • Description, the two new catalog strings, the attached description naming no drag: verified (en.json:626, :646).
  • Description, the record, doc entry, story and changeset edits as listed: verified.
  • Description, the unit tests fail on the base and 33 pass: the base has no attach; the file now holds 35 cases (two direction cases came later), not yet run on this head.
  • Description, each listed unit case and the browser spec's coverage: verified as written; not yet run on this head.
  • Description, first-load deltas within the 0.3 KB limit: stated for an earlier merge; the shared-module changes are unchanged since.
  • Description, the regression run and the typecheck, lint and catalog checks: stated for earlier commits; not yet run on this head.
  • Description, the known and queued follow-ups: still present as described.
  • Description, the land-path line (held for an owner decision): out of date; the decision is recorded for this head.
  • .changeset/reorderable-attach-plain-elements.md: clear.
  • apps/storybook/stories/createReorderable.stories.tsx: clear.
  • docs/specs/AST-103-reorderable/spec.md: clear.
  • packages/core/locales/en.json: clear.
  • packages/core/src/List/listReorderContext.ts: clear.
  • packages/core/src/List/listReorderEngine.tsx: clear.
  • packages/core/src/internal/reorder.ts: clear.
  • packages/core/src/privateAttributes/listReorder.stylex.ts: clear.
  • packages/core/src/reorderable/__tests__/ReorderableAttachMode.interaction.browser.spec.ts: clear.
  • packages/core/src/reorderable/attachReorderable.server.test.ts: clear.
  • packages/core/src/reorderable/attachReorderable.test.ts: clear.
  • packages/core/src/reorderable/attachReorderable.ts: non-blocking notes at 5-23, 136, 438-440 and 484-486.
  • packages/core/src/reorderable/createReorderable.doc.mjs: non-blocking note at 50.
  • packages/core/src/reorderable/createReorderable.ts: clear.
  • packages/core/src/utils/accessibleName.ts: clear.

Automated review (maintainer link)

Comment on lines +438 to +440
// The host sits outside the container's direction region, so it takes
// the container's direction each time the mode starts: the hint's
// buttons then mirror as List's hint does.

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.

Non-blocking (INV29): this is one 28-word sentence with two topics, over the 25-word limit for a description. Suggested:

// The host sits outside the container's direction region. It copies that
// direction at each mode start, so the hint mirrors as List's hint does.

This branch was successfully deployed

1 active deployment
Preview — 044385a6 Deployed Nov 25, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) ci:run-a11y Run the accessibility suite on this PR; write access, next push (AST-030 FR12) ci:run-rtl Run the RTL suite on this PR; write access, next push (AST-030 FR12) CLA Signed This label is managed by the Meta Open Source bot. lane:1 Astryx fix-loop lane 1 owns this needs:design-review Affects visuals — Design should review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants