react-sortable-hoc icon indicating copy to clipboard operation
react-sortable-hoc copied to clipboard

tile position calculation is broken

Open TrejGun opened this issue 7 years ago • 6 comments

from #520

image When an element of a row is moved to an upper one, get a overflow

the problem is seen only on certain conditions. here is my code https://codesandbox.io/s/w68jykzw58 showing the bug you can fix it by removing overflowX: "hidden" from the wrapper

TrejGun avatar Apr 08 '19 19:04 TrejGun

I have a parent container that needs overflow: auto and the same issue happens.

keyranova avatar Apr 17 '19 18:04 keyranova

i have position calculation problem too, what is wrong here?

https://streamable.com/rmp97

crapthings avatar May 18 '19 08:05 crapthings

okay its something like this

https://github.com/atlassian/react-beautiful-dnd/issues/352

grid layout

const SortableList = SortableContainer(({items}) => {
  return (
      <div className='page-grid'>
        {items.map((value, index) => (
          <SortableItem key={`item-${index}`} index={index} value={value} />
        ))}
      </div>
  )
})
.page-grid
  flex 1
  display grid
  grid-template-columns: 1fr 1fr 1fr 1fr
  grid-gap 32px
  padding 32px

crapthings avatar May 18 '19 08:05 crapthings

@crapthings - when drag occurs, it adds translate3d(AAApx, BBBpx, CCCpx) where AAA is your grid element width. What happens is that when calculating how much it should add to transform, it does not account for grid-gap. I've found that it can be fixed by adding padding inside your grid element instead of convenient grid-gap.

Screenshot 2019-07-19 at 07 46 36

Same happened to me 😢

knarkunas avatar Jul 19 '19 05:07 knarkunas

I have a parent container that needs overflow: auto and the same issue happens.

I have the same problem, how to fix it? Help wanted

superdc avatar Oct 10 '19 09:10 superdc

@superdc use this for guidance: https://github.com/clauderic/react-sortable-hoc/issues/577

Or use version 1.7.1 as a quick fix. Just let's hope later versions did not add what you might need.

knarkunas avatar Oct 10 '19 09:10 knarkunas