motiondivision / motiondivision/motion

[BUG] `Reorder.Item` gets a random offset if it's scaled during whileDrag

Open
#1,764 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
33.7k
Forks
1.4k
Avg merge
1d 10h
Merged PRs (30d)
14

Description

Describe the bug

In my app I have a table where you can reorder items and while you drag them around, they are slightly scaled. However on some drag events a negative translateX is applied to the Reorder Item, that should not be there. I created a minimal reproducible example in Codesandbox where the issue seems very small (max. 1px) but in my original code the offset sometimes incrementally increases over 100px (≈10px at a time).

Provide a CodeSandbox reproduction of the bug

https://codesandbox.io/s/red-frog-7ol68d

Steps to reproduce

  1. Open the codesandbox link in a Chromium based browser
  2. Reorder one item a couple of times
  3. See that the reordered item is not aligned with the other ones.

Expected behavior
Item should be aligned with items that were not reordered.

Screenshot
Bildschirmfoto 2022-11-10 um 16 23 02
Bildschirmfoto 2022-11-10 um 16 25 09

Environment details
mac OS, Google Chrome 107

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked CodeSandbox reproduction in Chromium and inspect Reorder.Item behavior when scaled during whileDrag. Reorder the item repeatedly and compare its transform and alignment with untouched items. Done means the reordered item remains aligned and no unexpected negative translateX accumulates.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.