Skip to content

fix(List): reorder still drags after the numbering toggles - #10849

Draft
vjeux wants to merge 3 commits into
meta:mainfrom
vjeux:bank/list-reorder-after-numbering
Draft

vjeux wants to merge 3 commits into
meta:mainfrom
vjeux:bank/list-reorder-after-numbering

Conversation

@vjeux

@vjeux vjeux commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #10815: its two commits come first (8daeb39 and 8903a22). Review the last commit, 4c8e1f4. This branch moves onto main when #10815 merges.

User impact

After a reorderable List's numbering (listStyle="decimal") turns on or off, a mouse drag or a finger's hold and drag from a row's handle moves nothing. Keyboard reorder mode still works.

Problem and solution fit

The List renders a new list element, an ol or a ul, when its numbering changes, and its rows mount again. The reorder host sits beside the list, so it stays mounted. It attached the list's pointer listeners and touch hold to the element it found first. Its effects ran again only for a new session, so the listeners stayed on the detached element.

The host now binds the list's mouse listeners, touch hold and names watch through Core's useAttachment, on a ref to the session's list element. After each commit, it releases a replaced element and attaches the new one. The attach functions take the element, and the names watch's own switch to a new element goes.

Expected behavior and authority

spec:AST-103 FR3: in every adopting collection, a drag starts from a row's handle, with a mouse at once and with a finger after a hold. Nothing exempts a numbered list.

Smallest restoration

  • Three existing host effects move onto useAttachment, which already owns this release and attach. List.tsx does not change.
  • A new story file with a button that turns the numbering on and off. List.stories.tsx has open pull requests.

Evidence

  • Reproduction before the change: on fix(List): a reorder handle's name follows its row's place and label #10815's head, the new browser spec fails 4 of 6 cases in Chromium and in WebKit. The mouse and the finger fail after one and two changes. A scratch copy of the story on main a0f2a2d fails the same 4. The two new jsdom cases fail on main.
  • Result after the change: the browser spec passes 6 of 6 in both engines, and the jsdom cases pass.
  • Representative unchanged path: units pass, 312/312: List, reorderable, the internal reorder entry, ListInput and TransferList. At one worker, the reorder, Dividers and numbering browser specs pass: 62 in Chromium, 44 with 18 skipped in WebKit. Reorder a11y: 13 pass.
  • Mutation-sensitive proof: each mutant of 4c8e1f4 fails named cases. They pin one binding to the first element: 43aa822 (mouse listeners), 0c994b9 (names watch) and 0a603d1 (touch hold). The last fails the finger cases in both engines.

Scope

  • One defect is restored.
  • Separable contradictory or unsettled tagalongs were removed or split.
  • No new public API, visual representation, default, or interaction model is hidden under the bug-fix label.
  • Public text and artifacts contain no internal Meta context.

Testing

  • pnpm exec vitest run packages/core/src/List packages/core/src/reorderable packages/core/src/internal packages/lab/src/ListInput packages/lab/src/TransferList
  • pnpm exec tsc --noEmit -p packages/core/tsconfig.json
  • Playwright, one worker: ListReorderNumbering, ListReorderMode, ListReorderPointer, ListReorderTouch and ListDividers interaction specs in Chromium and WebKit, and the TransferList and ListInput reorder a11y specs.

Conformance tidy, no visible change. The reorder session's list getter
and the mode hint's layer handle were copied into refs during render.
Each is now written in a one-line layout effect, so a render React
discards leaves nothing behind. No failure is reachable today. Every
list getter returns the same element. The layer ref's only reader is
the hint's layout effect. It reads the ref at the commit, right after
the committed render wrote it. The cleanup uses the handle it captured.
@vercel

vercel Bot commented Nov 9, 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 9, 2026 7:15pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 9, 2026
@astracat-bot

astracat-bot Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 9, 2026, 7:26 PM UTC

A reorder handle named itself from the DOM in a passive effect: after
Item's label element when that element shows a name, else after the
row's place ("Reorder item N"). The effect ran only when the handle
rendered. A memoized row whose place changed, because a row above it
went or the rows reordered, kept the old place in its handle's name. A
label that gained or lost its text through its own state left the
handle named the old way.

The reorder session now reads both from the DOM, outside React. It
registers the list's rows and its handles' label elements with Core's
shared mutation observer, and releases them with the list. It keeps
each handle's label naming, and the place only for a handle named after
it. The handle reads them through useSyncExternalStore, as it reads
reorder mode, and renders its name from them. Only a change renders
the handle again, so its passive effect is gone. A row named after its
place still warns in development, once, from the session. positionOf
loses its last caller and goes.

The session follows the list element the List renders, which changes
when its numbering turns on or off.

ListReorderNames.test.tsx covers a row above that goes, a reorder, and
a label that gains and loses text: each fails on main and passes here.
A reorder after the numbering turns on passes on both.

@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 fix restores dragging after the numbering toggles (spec:AST-103 FR3) and keeps reorder handle names current (FR4), and the new jsdom tests fail on main and pass here; one structural change is needed before approval.

  • ListReorderHost and its new list-element counter (listChanges, subscribeList, listVersion and the replacement check in refreshNames) re-implement what Core's shared useAttachment (packages/core/src/hooks/useAttachment.ts) already does, releasing a replaced node and attaching the new one, so please bind attachMouse, attachNames and attachTouch (keyed on isTouch) through useAttachment and delete the counter.

One non-blocking comment-wording suggestion is inline.

[Automated review]

List renders a new list element, an ol or a ul, when its numbering
(listStyle "decimal") turns on or off. The reorder host attached the
list's pointer listeners and touch hold to the element it found on
mount, and its effects ran again only for a new session. So after the
numbering changed, a mouse drag or a finger's hold and drag from a
handle moved nothing. The handle's keyboard mode still worked.

The host now binds the list's mouse listeners, touch hold and names
watch through Core's useAttachment, on a ref to the session's list
element. After each commit, it releases a replaced element and
attaches the new one. The attach functions take the element, and the
names watch's own switch to a new element goes.

ListReorderNumbering.test.tsx drags with a mouse in jsdom after the
numbering turns on, and after it turns off again. A new story turns
the numbering on and off, and its browser spec drags with a mouse and
a finger after 0, 1 and 2 changes. Before this change, every drag
after a change moved nothing, in Chromium and WebKit.
@vjeux
vjeux force-pushed the bank/list-reorder-after-numbering branch from 0abbde6 to 4c8e1f4 Compare November 9, 2026 19:05
@github-actions github-actions Bot added the needs:design-review Affects visuals — Design should review label Nov 9, 2026
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

PR Analysis Report

Current run: The current CI run concluded skipped. Current analysis is unavailable.


Generated by PR Enrichment workflow | View current CI run

@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. The pull request is a draft from a fork, so CI runs once it is marked ready for review and a maintainer adds the ci:run label.

The reorder host now binds the list's mouse listeners, touch hold and names watch through Core's useAttachment, which resolves the earlier request, and dragging after the numbering toggles is restored (spec:AST-103 FR3) along with current handle names (FR4). The new jsdom tests fail on main and pass here, and in Chromium the mouse and finger drags after one and two numbering changes fail on main and work on this branch.

[Automated review]

This branch was successfully deployed

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

Labels

CLA Signed This label is managed by the Meta Open Source bot. needs:design-review Affects visuals — Design should review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant