clauderic / clauderic/react-sortable-hoc
fix for incorrect next-node sorting calculation in animateNodes
- Dominant language
- JavaScript
- Stars
- 10.9k
- Forks
- 959
- PR merge metrics
- No merged PRs in 30d
Description
Hi, thanks for you hard work on this component, it's really awesome! I'm currently using it for re-ordering headers in a grid and noticed that dragging a long column header to the right over shorter column headers doesn't behave the same when dragging to the left.
It looks like a calculation issue in [SortableContainer/index.js, at line 558](https://github.com/clauderic/react-sortable-hoc/blob/master/src/SortableContainer/index.js#L558)
`if (index > this.index && (sortingOffset.left + offset.width >= edgeOffset.left)) {`
I believe it should be comparing against the right-side of the component being sorted, which results in the following:
`if (index > this.index && (sortingOffset.left + this.width + offset.width >= edgeOffset.left + node.offsetWidth)) {`
and this matches the calculation for comparing against the previous node.
I believe the same logic applies in the y direction (although I haven' tested it)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.