Skip to content

fix: Custom handle offset when the handle is left of the screen edge - #641

Draft
MatiPl01 wants to merge 2 commits into
mainfrom
fix/custom-handle-offscreen-offset
Draft

MatiPl01 wants to merge 2 commits into
mainfrom
fix/custom-handle-offscreen-offset

Conversation

@MatiPl01

@MatiPl01 MatiPl01 commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

Description

With customHandle, the offset of the handle is measured when a drag starts. The measured pageX was passed through (x + 9999) % 9999 to remove the off-screen offset of hidden items, which turns a negative pageX into a value close to 9999.

So when the handle of the dragged item was partly off the left edge of the screen (an item partly scrolled out of a horizontal ScrollView), the touch position was off by 9999: horizontal auto scroll jumped to the end of the list and the reorder trigger position was wrong.

The off-screen offset is now removed only on the old architecture, the only place where a hidden item is moved off the screen, and only from positions that contain it.

Testing

New jest tests with a mocked measure (the negative position case fails on main: expected -50, received 9949; the others guard the positions that already worked, including a handle far to the right on a very wide web viewport).

Evidence
Tests on main before-tests-on-main.txt
Tests with the fix after-tests-with-fix.txt

The modulo that removes the hidden item offset turned a negative page position into a value close to that offset, so the touch position of the dragged item was off by 9999 when its handle was partly scrolled off the left edge.
@vercel

vercel Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated
react-native-sortables-docs Ignored Ignored Preview Nov 26, 2026 1:51pm UTC

@MatiPl01 MatiPl01 self-assigned this Nov 25, 2026
Only Paper moves a hidden item out of the viewport, so a visible handle further than half of that offset to the right (a very wide web viewport) must not be treated as hidden.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant