Repository navigation
Conversation
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.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
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.
There was a problem hiding this comment.
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.
ListReorderHostand its new list-element counter (listChanges,subscribeList,listVersionand the replacement check inrefreshNames) re-implement what Core's shareduseAttachment(packages/core/src/hooks/useAttachment.ts) already does, releasing a replaced node and attaching the new one, so please bindattachMouse,attachNamesandattachTouch(keyed onisTouch) throughuseAttachmentand 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.
0abbde6 to
4c8e1f4
Compare
PR Analysis Report
Generated by PR Enrichment workflow | View current CI run |
There was a problem hiding this comment.
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]
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
olor aul, 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-103FR3: 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
useAttachment, which already owns this release and attach.List.tsxdoes not change.List.stories.tsxhas open pull requests.Evidence
Scope
Testing
pnpm exec vitest run packages/core/src/List packages/core/src/reorderable packages/core/src/internal packages/lab/src/ListInput packages/lab/src/TransferListpnpm exec tsc --noEmit -p packages/core/tsconfig.jsonListReorderNumbering,ListReorderMode,ListReorderPointer,ListReorderTouchandListDividersinteraction specs in Chromium and WebKit, and the TransferList and ListInput reorder a11y specs.