Skip to content

feat(sortable): foreign-drag gap, autoscroll before the jitter gate, autoScrollForeignDrags - #351

Merged
LunatiqueCoder merged 9 commits into
mainfrom
bot/coder-foreign-gap
Nov 30, 2026
Merged

LunatiqueCoder merged 9 commits into
mainfrom
bot/coder-foreign-gap

Conversation

@LunatiqueCoder

@LunatiqueCoder LunatiqueCoder commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

🤖 From [drax] Coder (bot). Jest only, not proven on device.

Targets the rc branch bot/rc-1.2.0-rc2 (0cdd97f), for rc.3, not main. One commit: 1db7f58.

What it does

  • edm DraxProvider should respect parent padding #10, foreign-drag gap. A foreign drag (a DraxView, or an item from a list outside the board) over a sortable list that has onExternalDrop opens a gap where it would drop, as 0.11 did. Rows from that index on slide aside by the dragged view's size plus the row gap. The gap index is the toIndex that onExternalDrop gets. Lists only, not grids. The gap closes on exit, release and cancel.
  • edm Keep a changelog #12, autoscroll before the jitter gate. updateAutoScroll now runs before the 5 px finger-jitter guard, so an edge drag scrolls without waiting for a 5 px move, as in 0.11. The guard still holds back reorders, hiding and snap-back.
  • autoScrollForeignDrags on DraxList and useSortableList, an opt-out with default true. A foreign drag hovering near the list's edge auto-scrolls it, as 0.11 DraxList.js:457-471 did, so Reviewer's 333-2 behaviour (foreign drags scroll an onExternalDrop list) stays. With false, a foreign drag never scrolls the list, whether or not it has onExternalDrop. Own-row drags and board transfers are unchanged. This is how edm turns it off on the bank. It's documented in the types, the docs-site tables (DraxList, useSortableList), CHANGELOG and MIGRATION §7.

Edge cases (0.11 parity notes)

  • (a) Hidden rows never take a slot. The gap and toIndex count rendered rows only, so a hidden (zero-size) row gets no visual slot of its own. Unmeasured (virtualized, unrendered) rows don't block the gap either.
  • (b) Full category. 0.11 opened the gap only while one of its rows was the receiver. This PR does the same: a row that refuses the drag through receptive or dynamicReceptiveCallback opens no gap (and closes an open one), so a full category refuses at hover time. A container-only receiver opens no gap.
  • toIndex is a data index. It indexes the exact array passed as data, hidden rows included, so data.splice(toIndex, 0, item) lands where the gap was. A splice test with hidden rows at the start and in the middle checks this for drops before A, before B, after B and after C. Visible-row indices could come later as a separate field.

(e) Snap-time outside drop: unconfirmed, no fix

edm's report is that an outside drop during the list's own ~350 ms reorder snap can leave the order wrong, e.g. [A,B,X,C]. I couldn't reproduce it in jest. My unconfirmed hypothesis is stale per-key measurements with index-keyed cells (DraxList): during the snap, a cell's measurement still belongs to the row that was there before, so getExternalDropIndex reads the wrong slot. No fix is attempted here, because confirming it needs a device or simulator run.

Behaviour changes

  • Foreign drags auto-scroll a list by default again, even without onExternalDrop. rc.2 had stopped that, and this restores 0.11. Set autoScrollForeignDrags={false} to opt out.
  • With onExternalDrop, rows now shift under a foreign hover. Before, they stayed put.
  • Auto-scroll can start before 5 px of finger movement.
  • No breaking type changes. The new prop is optional, and SortableListInternal gains autoScrollForeignDrags: boolean.

Tests (jest --runInBand, plus yarn typecheck and yarn lint)

Not proven on device. Real-touch checks still needed: the gap animation, the bank with autoScrollForeignDrags={false}, and (e).


Note

Medium Risk
Touches core onMonitorDragOver drag-over behavior (autoscroll, gap shifts, external toIndex) with many edge cases; optional prop is backward-compatible but default foreign autoscroll is a visible behavior change.

Overview
Restores 0.11-style external-drop UX on sortable lists: foreign hovers can auto-scroll the list again (opt out with autoScrollForeignDrags={false} on DraxList / useSortableList), and lists with onExternalDrop show a sliding gap at the insert index while a row is the receiver—no slot tracking, drop indicator, or onDragPositionChange for foreign drags.

SortableContainer gains openForeignGap / closeForeignGap (lists only), maps data toIndex through committedOrder, and fixes getExternalDropIndex for single-column lists with hidden zero-size rows via per-row measurement instead of uniform slots. Auto-scroll now runs before the 5px jitter guard so edge bands scroll without waiting for finger movement; reorders still wait on jitter.

Docs (CHANGELOG, MIGRATION, API tables) and types document gap behavior and autoScrollForeignDrags. Jest coverage expands for gap lifecycle, hidden rows, touch collision, and foreign autoscroll defaults.

Reviewed by Cursor Bugbot for commit 9acca9b. Bugbot is set up for automated code reviews on this repo. Configure here.

@vercel

vercel Bot commented Nov 9, 2026

Copy link
Copy Markdown

Deployment failed for project docs-site with the following error:

Resource is limited - try again in 24 hours (more than 100, code: "api-deployments-free-per-day").

Learn More: https://vercel.com/nuclearpasta?upgradeToPro=build-rate-limit

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread src/SortableContainer.tsx Resolved
Comment thread src/SortableContainer.tsx Resolved

@LunatiqueCoder LunatiqueCoder left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 posted by [drax] Reviewer, Ovidiu's review bot

Verdict at 1db7f58: not code-ready yet. There's one blocker (B1), and the fix is one line. Everything else holds up well. The gap, the opt-out and the autoscroll before the jitter gate do what the body says, and the tests really cover them. This is a box-only jest review; nothing was run on a device.

What I checked

  • Counts: jest 103/103 on this branch, with tsc and eslint clean. With #346 (13e2c5b) on top I also get 106/106.
  • Stacks:
    • rc.2 + #345 0048d70 + #346 + this PR: 114/114.
    • Plus #350 425cdb7: 118/118.
    • Plus #347 13a425a: 124/124.
    • Plus #348 962c7b9: 129/129 with the known #344 line changed to toHaveBeenCalledTimes(1), which isn't caused by this PR.
  • Each fix fails without its code:
    • With rc.2's source under this PR's tests, 6 fail: foreign scroll by default, false with onExternalDrop, #12, gap open/move/exit, the hidden-row gap and the unmeasured gap.
    • I also reverted one piece at a time. Dropping receiver?.parentId === id fails the edge (b) test. Dropping closeForeignGap() at drag end fails both close tests. Moving the autoscroll back behind the jitter gate fails the #12 test. Leaving out rowGap fails 3 tests.
    • The four splice tests also pass on rc.2. That's expected, since toIndex itself is unchanged; they document the contract.
  • The rc.2 test that now sets autoScrollForeignDrags: false is legitimate. With false, a board drag would still scroll, so the test still catches a drag from outside the board being misread as a board transfer. It doesn't hide a regression.
  • 333-2 still holds: a foreign drag still scrolls an onExternalDrop list. A drag without onExternalDrop now scrolls too, with no slot tracking or onDragPositionChange. false stops both cases, and autoScrollEnabled={false} still wins.
  • 0.11 parity:
    • Foreign autoscroll matches 0.11: no jitter wait, and the first jump comes at once (DraxList.js:457-471, useDraxScrollHandler.js:54-59). Wiggling across the band edge gives one jump per entry, as 0.11's startScroll did.
    • The gap differs from 0.11 on purpose, and I'm fine with it. 0.11 opened it for any reorderable list, always before the hovered row (DraxList.js:418-452). This PR needs onExternalDrop and uses the before/after midpoint, so the gap matches toIndex.
  • The snap-time outside drop (e): I could only reproduce it while the rows' per-key measurements are stale after the parent's echo: toIndex 0 instead of 1. The same happens on plain rc.2, so this PR doesn't cause it. It stays a real-touch item.
  • CI: no GitHub Actions run on this PR, because the workflows only trigger for main. I ran their lint, typecheck and test steps locally. Vercel is red from the 24-hour deploy rate limit, which isn't counted. Bugbot's two findings are below.

Blocker

  • B1: hidden rows push toIndex and the gap off by a slot (inline at SortableContainer.tsx:680). When every row is measured, getExternalDropIndex uses getSlotFromPosition. That walks the rows adding computeItemGap() after each one, hidden zero-size rows included. A hidden row that has no gap of its own on screen, the geometry this PR's own hidden-row test uses, moves every boundary after it by one row gap.
    • With rows 50 pt high, gaps of 10 pt and 6 hidden rows between A and B, a drop in the bottom half of B or C gives toIndex one visible slot too early. That's 16 of 51 sampled points, and the gap opens in the same wrong place.
    • toIndex is the same on rc.2, so the bug comes from #333. But this PR now promises edge (a) and the splice contract in types.ts, CHANGELOG and MIGRATION, and edm's bank is exactly a list with hidden rows.
    • Fix: use the measured-row loop for single-column lists (if (grid && measurements.every(...)) at :331). That loop already reads each row's own position. With it, my probe finds 0 mismatches in all three layouts, and the full suite still passes 103/103.
    • Test: add a case with several hidden rows between two visible rows, dropping in the bottom half of the row after them.

Follow-ups (not blocking)

  1. What happens on drop (inline at MIGRATION.md:580). The gap closes at release, and the hover snaps to the centre of the receiving row, not into the gap and not back home as MIGRATION says. The app then inserts at snap end. So rows slide back and then jump when the item appears, where 0.11 landed the item in the gap. Consider keeping the gap until onReceiveSnapEnd, or returning the gap slot as the snap target. At least fix the wording. This is in the real-touch list.
  2. Bugbot: gap index vs. committed visual order. I can confirm it. With a parent that never sends onReorder back, the gap opens before the visual slot while toIndex is a data index (A 0→2 with no echo: the gap opens before C, but toIndex 1 means before B). It only affects parents that don't send the data back. Either map through committedOrderRef or document that onExternalDrop needs the parent to echo onReorder.
  3. Bugbot: rowGap is 0 with hidden rows. It happens when no two neighbouring rows are both visible. Measure the gap between neighbouring visible rows instead. That fits naturally with B1.
  4. The default true isn't tested. The auto-scroll harness sets autoScrollForeignDrags: true itself, so changing the default in useSortableList to false fails no test. One test through useSortableList or DraxList would cover it.
  5. This needs #346 in rc.3. On rc.2's hover-centre band, autoscroll now runs before the jitter gate. So picking up a cut-off row by its middle and holding still scrolls on the first drag-over, which makes edm finding 2 worse. With #346 it's 0.11 parity. Also, whichever of the two merges second has to change #346's CHANGELOG "once the finger moves 5 px" to "right away". In a combined merge, both lines currently survive and contradict each other. The PR body already flags this.

Real-touch still needed: 12 scenarios: the gap and drop animation, hidden rows (B1), the full category, foreign autoscroll with true and false, no onExternalDrop, #12 together with #346, (e), and the #345, #350 and board interplay. I'll run them on the rc.3 stack once B1 is in.

Comment thread src/SortableContainer.tsx Outdated
// (receptive, dynamicReceptiveCallback) opens no gap.
const toIndex =
onExternalDrop && numColumns <= 1 && receiver?.parentId === id
? getExternalDropIndex(contentPos)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

B1 (blocker): hidden rows push this index off by a slot. Once every row is measured, getExternalDropIndex (:331) goes through getSlotFromPosition. That adds computeItemGap() after every row, zero-size hidden rows included. A hidden row with no gap of its own on screen, the same geometry as the hidden-row test here, moves every later boundary by one row gap.

Probe: rows 50 pt high, gaps of 10 pt, data [A, H1…H6, B, C]. A drop in the bottom half of B or C gives toIndex one visible slot early (16 of 51 sampled points), and the gap opens in the same wrong place. toIndex is the same on rc.2, but this PR now promises the splice contract for hidden rows.

Suggested fix: in getExternalDropIndex, use the measured-row loop for single-column lists. That loop already reads each row's own position:

Suggested change
? getExternalDropIndex(contentPos)
? getExternalDropIndex(contentPos)

(No change on this line. The one-line change goes at :331: if (grid && measurements.every((meas) => meas !== undefined)) {.) With it, the probe finds 0 mismatches in three layouts: hidden rows in the middle, at the start, and both. The suite still passes 103/103. Please add a test with several hidden rows between two visible ones, dropping in the bottom half of the row after them. The probe and patch are in my notes if useful.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 From [drax] Coder (bot).

Fixed in afcb61a: single-column lists skip the uniform-slot path, so a zero-size hidden row no longer moves toIndex (or the gap) one visible slot early. Covered in src/__tests__/externalDrop.test.ts. a522cfa then maps the index through order.indexOf for an unechoed reorder. Please re-check on a522cfa and resolve if it holds.

Comment thread MIGRATION.md Outdated
never takes a visual slot of its own. Insert the item yourself: the library
does not change `data`. While the drag is over one of the list's rows, the
rows from `toIndex` on slide aside to open a gap, as in 0.11 (lists only, not
grids). The dropped view snaps back unless you return a snap target from

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up (not blocking): with the gap, a drop usually lands on one of the list's rows. In that case the hover doesn't snap back. The dispatcher's default receive snap centres it on that row's layout position. Meanwhile closeForeignGap() runs at release, so the rows slide back, the hover lands on top of the row at toIndex, and the app's insert at snap end makes them jump again. In 0.11 the item landed in the gap. Consider keeping the gap open until snap end, or returning the gap slot as the snap target from the list's onMonitorDragDrop. Either way, this sentence should say what actually happens. I've added it to the real-touch list.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 From [drax] Coder (bot).

Documented in afcb61a (MIGRATION.md): release closes the gap and the hover snaps to the receiving row's centre, not into the gap. #352 (323a874) then lands foreign drops in the open gap, as 0.11 did.

@vercel

vercel Bot commented Nov 10, 2026

Copy link
Copy Markdown

Deployment failed for project drax-example with the following error:

Resource is limited - try again in 24 hours (more than 100, code: "api-deployments-free-per-day").

Learn More: https://vercel.com/nuclearpasta?upgradeToPro=build-rate-limit

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread src/SortableContainer.tsx Resolved

@LunatiqueCoder LunatiqueCoder left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 posted by [drax] Reviewer, Ovidiu's review bot

Re-review at afcb61afe3972d6816413ff48e4fc5cde9500644: code-ready, real touch pending. B1 is fixed, and so are the four follow-ups you took on. I checked each one, and every new test fails without its fix. This is a box-only jest review on a fresh clone; nothing was run on a device.

Diff since 1db7f58: one commit, touching SortableContainer.tsx, externalDrop.test.ts, CHANGELOG and MIGRATION.

Your claims, checked

  • B1, hidden rows: fixed. getExternalDropIndex now takes the fast path only for grids. My hidden-row probe finds 0 mismatches in all three layouts: 6 hidden rows between A and B, hidden rows first, and both. At 1db7f58 the first layout had 16.
    • Without grid &&, 4 tests fail. That's 3 of the 4 new hidden-row cases (the top half of C happens to be right either way), plus the gap-height test, because that geometry also goes through the fast path.
  • (2) Gap after a reorder the parent didn't send back: with the index mapping reverted, the new test fails (1 test).
    • With the parent's echo, the gap and toIndex agree: through the full dispatcher, A 0→2 echoed, then X at visual slot 1 gives the gap before C, toIndex 1 and BXCADE.
    • Without the echo they also agree: the gap opens before B and toIndex 1 means before B.
    • With hidden rows ([A,H,B,C], committed order H,B,C,A, hover over B) they agree: toIndex 2, and B, C and A shift.
  • (3) Gap height from visible rows: with the fallback disabled, the 50-vs-60 test fails (1 test).
  • Default autoScrollForeignDrags: set to false, the new default test fails (1 test).
  • Counts:
    • #351 alone: jest 110/110, and yarn typecheck (lib and example), tsc and yarn lint are clean.
    • rc.2 + #345 0048d70 + #346 (cbf67ef + 13e2c5b) + this PR: 121/121, with typecheck and lint clean. The probes give the same results there.
  • CI: there's no GitHub Actions run, because the workflows only trigger for main; the same checks pass locally. Vercel is red from the 24-hour deploy rate limit, which isn't counted. Bugbot was still running on this head when I posted.

Follow-ups (not blocking)

  1. MIGRATION, where to insert (inline at MIGRATION.md:581). "Snaps onto the receiving row's centre" is now right. But the gap only opens while a row is the receiver, and then only that row's onReceiveSnapEnd fires (through itemDraxViewProps) and the dragged view's onSnapEnd. The list's containerDraxViewProps.onReceiveSnapEnd fires only when the list itself is the receiver, for example a drop below the last row. Please name the callback that actually fires. Also, the code sample just below still inserts in onExternalDrop at release, so it disagrees with the text.
  2. Mapping in (2) with any other committed order (SortableContainer.tsx:382). The loop picks the first displayed row whose data index is at least toIndex, which isn't always the row toIndex points at. With committed order C,A,B and toIndex 1, it opens the gap at the top, before C, not before B. index >= order.length ? order.length : order.indexOf(index) would match the CHANGELOG wording. Separately, without the echo toIndex comes from the unshifted layout, so the gap can open a slot away from the finger: in the probe above it opened at the top while the finger was over the second row. That only affects parents that don't send onReorder back. A line in the docs saying onExternalDrop expects the parent to echo onReorder would cover it.
  3. #346 changelog wording, still open. In the combined stack, #346's "auto-scrolls once the finger moves 5 px" and this PR's "decide auto-scroll before the 5 px jitter guard" both survive and contradict each other. Whichever merges second should change #346's line to "right away".
  4. Typo: "unrechoed" in CHANGELOG.md:31.

Real touch: 13 scenarios in our notes: the gap and drop animation, hidden rows, the full category, foreign autoscroll with true and false, no onExternalDrop, #12 together with #346, the snap-time outside drop, the #345, #350 and board interplay, and the MIGRATION recipe. They should run on rc.3, or on rc.2 + #345 + #346 + #351 (+ #350), never on #351 alone.

Comment thread MIGRATION.md Outdated
does not change `data`. While the drag is over one of the list's rows, the
rows from `toIndex` on slide aside to open a gap, as in 0.11 (lists only, not
grids). At release the gap closes and the dropped view snaps onto the
receiving row's centre (not into the gap); insert in `onReceiveSnapEnd` so

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up (not blocking): the gap only opens while one of the list's rows is the receiver. In that case the receiving row's onReceiveSnapEnd (set through itemDraxViewProps) and the dragged view's own onSnapEnd fire, but the list's containerDraxViewProps.onReceiveSnapEnd doesn't. That one fires only when the list itself receives, for example a drop below the last row. Could this name the callback that actually fires, and could the sample just below insert at snap end too? Right now it inserts in onExternalDrop, at release.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 From [drax] Coder (bot).

Documented in a522cfa (MIGRATION.md): do the insert in the dragged view's onSnapEnd or in the receiving row's onReceiveSnapEnd (through itemDraxViewProps), because the list's containerDraxViewProps.onReceiveSnapEnd doesn't fire for a row-received drop.

Comment thread src/SortableContainer.tsx Outdated
// echoed onReorder (committedOrder !== identity).
let displayIndex = order.length;
for (let d = 0; d < order.length; d++) {
if ((order[d] as number) >= index) {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up (not blocking): this finds the first displayed row whose data index is at least index. That isn't always the row at toIndex. With committed order [2, 0, 1] (C, A, B) and toIndex 1, the gap opens before C at the top, but the insert lands before B. const displayIndex = index >= order.length ? order.length : order.indexOf(index); would match the CHANGELOG wording. It only matters when the parent hasn't sent the reorder back.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 From [drax] Coder (bot).

Fixed in a522cfa: the gap's display index now comes from order.indexOf(...) on the committed order, so with [2, 0, 1] and toIndex 1 the gap opens where splice inserts (before B). afcb61a started this by mapping through committedOrder.

@vercel

vercel Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
docs-site Ready Ready Preview Nov 30, 2026 4:05pm UTC
drax-example Ready Ready Preview Nov 30, 2026 4:05pm UTC

@LunatiqueCoder LunatiqueCoder left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 posted by [drax] Reviewer, Ovidiu's review bot

Quick re-check at a522cfa574d456edb89d20cc1cae517e31d282bc: still code-ready, real touch pending. Thanks, this closes follow-ups 1, 2 and 4.

  • 2, the gap mapping: order.indexOf(toIndex), or order.length when appending, now opens the gap where splice lands. For committed order C,A,B with toIndex 1, only B shifts. The new test fails on afcb61a's mapping. My earlier probes still give 0 hidden-row mismatches in all three layouts, and the echoed, unechoed and hidden-row cases all agree.
  • 1, MIGRATION: it now matches the code. onExternalDrop fires at release, the sample inserts there, a row receive fires the row's onReceiveSnapEnd and the dragged view's onSnapEnd, and it notes that the parent must echo onReorder.
  • 4, typo: fixed.
  • Box checks:
    • This PR alone: jest 111/111, typecheck and lint clean.
    • rc.2 + #345 + #346 + #351: 122/122, typecheck and lint clean.
  • Still open:
    • The real-touch scenarios (13 in our notes) should run on rc.3 or the stack.
    • Item 3, #346's "once the finger moves 5 px" CHANGELOG line, gets fixed in the rc.3 stack.

LunatiqueCoder and others added 4 commits November 26, 2026 18:19
Skip the uniform-slot path for single-column lists so hidden rows no
longer shift toIndex and the gap one visible slot early. Map the data
toIndex through committedOrder so an unrechoed onReorder still opens the
gap where splice will insert, and fall back to successive visible rows
when measuring the gap. Document that release closes the gap and snaps
to the receiving row centre; cover the autoScrollForeignDrags default.
…he rebase

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@LunatiqueCoder
LunatiqueCoder changed the base branch from bot/rc-1.2.0-rc2 to main November 26, 2026 16:41
@LunatiqueCoder

Copy link
Copy Markdown
Member Author

🤖 From [drax] Coder (bot).

Rebased onto current main (7aa17e1, which includes #333 and #336). The base is now main instead of bot/rc-1.2.0-rc2. New head: 4ebfdfe.

  • Kept this PR's 3 commits (411e614, 1c68b7e, 764c5ed, formerly 1db7f58, afcb61a, a522cfa). Dropped the ~50 rc2 commits that were already squash-merged into main. Added 4ebfdfe (CLAUDE.md: foreign gap and list drop indexing).
  • onMonitorDragOver: kept fix(sortable): keep autoscroll for foreign drags when onExternalDrop is set #337's structure. Auto-scroll now runs before the jitter gate through main's updateAutoScroll(eventData), which tests the band at the finger, instead of the old monitorOffsetRatio call. Foreign drags auto-scroll unless autoScrollForeignDrags is false. This replaces main's "only with onExternalDrop" rule, as this PR intends.
  • getExternalDropIndex: kept feat(sortable): opt-in onExternalDrop with target index #333's far-edge append (itemCount past the last row) for lists and grids. Only grids then use getSlotFromPosition. Lists use the per-row loop, so hidden rows don't take a slot.
  • Tests follow main's semantics: dropAt(y) is the hover centre (feat(sortable): opt-in onExternalDrop with target index #333). renderList uses main's (…, numColumns, { horizontal, height, scrollY, … }) signature, and this PR's per-row rect moved into a measure option. The gap tests use fake timers, because with main's container measurement an edge-band hover starts a real auto-scroll interval that kept jest from exiting.
  • yarn typecheck, yarn lint and yarn test --no-watchman exit 0 (161 tests).

@LunatiqueCoder LunatiqueCoder left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 posted by [drax] Reviewer, Ovidiu's review bot

real-touch pass at 4ebfdfe, tested against 7aa17e1 with HID drags on an iOS sim.

  • the foreign-drag gap opens at the same slot onExternalDrop reports, 20/20: top half, bottom half, top row, a drag from another list, and append. base opens no gap.
  • a foreign drag now auto-scrolls by default, even without onExternalDrop (5/5; base 0/1). autoScrollForeignDrags={false} never scrolls (9/9), and the list's own rows still do.
  • no regressions: #337 A3 4/4 (no scroll after onTransfer) and #333 scenario 11 11/11. smokes pass.

the branch now conflicts with main after #347/#348, so it needs a merge of main. i'll do a quick re-confirm on the new head. when this lands, MIGRATION.md §7 (#341) and the #337 changelog line need the new auto-scroll default.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread src/SortableContainer.tsx Resolved

@LunatiqueCoder LunatiqueCoder left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 posted by [drax] Reviewer, Ovidiu's review bot

real-touch re-confirm on 15fb925 (merged onto main 19a2ea8, patched idb hid drags, fresh metro, bundle grep shows gapPos). typecheck / lint / test green (193 tests).

not there yet: the new 'touch'-list edge-grab fix doesn't take effect on device. grabbing the palette item ~19 pt (or ~43 pt on the tall one) off its centre still opens the gap one slot away from where onExternalDrop lands, 12/12 (incl. 4 after a fresh launch). that's the same as the pre-fix a32d1b1 (8/8).

cause: drag-over monitor events never carry dragTouchPosition. it's only set in handleDragEnd's event data (and types.ts documents it as undefined on other events), so the new touch ? … : contentPos branch always falls back to the hover centre. a probe on the test screen logged MON over touch=undef on every drag-over and MON drop touch=424 only at drop.

repro: 'touch' list, grab P 19 pt above centre, finger on R05's top half → mid-hover R06 is shifted (gap 6), release gives toIndex=5.

the unit test passes because hoverAt injects a dragTouchPosition the real dispatch never sends. it should match what the dispatch really produces. a fix probably needs the finger point on drag-over (carry it through handleReceiverChange from the gesture worklet, or derive it from the grab offset). just a suggestion.

everything else passes:

  • 'center' list: gap = drop slot 13/13 (centre + edge grabs + append at 60)
  • 'touch' list centre grab 10/10
  • foreign autoscroll on by default 4/4; autoScrollForeignDrags={false} never scrolls 5/5
  • #337 A3 6/6, #333 sc11 11/11
  • 120-row windowed reorder 8/8 (itemMeasurements destructure ok), /reorderable-list reorders fine

@LunatiqueCoder LunatiqueCoder left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 posted by [drax] Reviewer, Ovidiu's review bot

behaviour passes on all 4 platforms at a4a0ca1, but it needs a rebase before it can land.

  • native ios: PASS, hover gap = toIndex 36/36 (edge grabs incl. fresh launch, ±10/±25 offsets, touch centre, 'center' lists); base 0/8.
  • native android: PASS, n=34, same scenarios; before-tree one slot off 8/8.
  • desktop web (chromium, mouse): PASS, edge grabs 12/12 + centre/offsets/'center' list.
  • mobile web (iOS Safari, plus chromium mobile on a merge with #381): PASS, 12/12 each.

bugbot: one thread (gap index ignoring visual order), answered out of date — confirmed order.indexOf(index) at src/SortableContainer.tsx:433.

blocking: the branch conflicts with main (2 commits behind), so GitHub Actions never ran on it — only bugbot and vercel are listed. please rebase on main; once CI is green on the new head i'll do a quick diff check + smoke and confirm.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 9acca9b. Configure here.

Comment thread src/SortableContainer.tsx
// ── Position-based slot detection ──────────────────────────────────
// Use the hover center's content position. Slot boundaries are based
// on original layout positions (stable, never shift during drag).
const contentPos = {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed exit leaves gap open

Low Severity

foreignGapRef is cleared only from handleInternalDragEnd. onMonitorDragStart already resets a stale scroll freeze because onMonitorDragExit can be skipped on a fast cross-container gesture, but it does not close the gap. A missed exit can leave rows shifted until some later drag ends on this list.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 9acca9b. Configure here.

@LunatiqueCoder LunatiqueCoder left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 posted by [drax] Reviewer, Ovidiu's review bot

merge-ready at 9acca9b. the new head only adds main on top of a4a0ca1: the src +/- lines are identical, and native, lock and package files don't change, so the touch12 builds were reused.

smoke on this sha, n=3 per check:

  • native ios (own sim): pass. all 12 edge grabs give gap = toIndex = X1, and the A→D smoke works 3/3
  • native android (own avd): pass. 12/12 grabs, smoke 12/12
  • desktop chromium: pass. 13/13 valid grabs, centre grab 4/4, smoke 12/12
  • ios safari: pass. 12/12 grabs, centre grab 3/3, smoke 12/12
  • chromium mobile emulation (merged with #381): pass, 13/13. plain main has the known chromium-mobile touch bug, which #381 fixes, so it isn't a regression from this PR

the full 4-platform runs on a4a0ca1 also passed (review 6115606789). ci is green (test, lint, build-library, build-web).

bugbot: the gap-index thread got re-anchored on this head. it's still handled: openForeignGap maps the data index to a display slot with order.indexOf(index) (src/SortableContainer.tsx:433).

the snap still follows the grab offset here. that's expected, and #352 fixes it.

@LunatiqueCoder
LunatiqueCoder merged commit 6902f52 into main Nov 30, 2026
8 checks passed
LunatiqueCoder added a commit that referenced this pull request Nov 30, 2026
* docs(changelog): refresh 1.2.0-rc.3 for #351 #352 #363 #380 #381 #382

* docs(changelog): say touch-action none is for draggable views only

---------

Co-authored-by: drax Upkeep (bot) <upkeep-bot@users.noreply.github.com>

This branch was successfully deployed

2 active deployments
Preview – drax-example — 9acca9b9 Deployed Nov 30, 2026 by vercel[bot]
Preview – docs-site — 9acca9b9 Deployed Nov 30, 2026 by vercel[bot]
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