smooth-dnd icon indicating copy to clipboard operation
smooth-dnd copied to clipboard

Once smooth-dnd is touched, can not scroll any more page

Open a-tonchev opened this issue 3 years ago • 7 comments

I write about this bug in the react-smooth-dnd, but after I check it looks like the bug is from smooth-dnd.

The bug apears on touch devices when you touch or scroll on the smooth-dnd container once, then no more page scrolling is possible.

Bug is reproduced in browser and also in mobile:

  1. Open demo page: https://kutlugsahin.github.io/smooth-dnd-demo/ with mobile chrome / or desktop chrome in Device-mode to simulate touch event

  2. Scroll or somehow touch the smooth-dnd container

-> no more native scrolling possible. You can not scroll top or bottom of the page any more. Page is like blocked.

Expected behavior: scrolling should be possible at any time, maybe only not when dragging item.

If you want guys, I can also upload a video?

Thanks and best regards

a-tonchev avatar Oct 21 '20 06:10 a-tonchev

My workaround:

const cleanClasses = () => { document.body.className = ''; };

document.addEventListener('touchend', cleanClasses, false);

a-tonchev avatar Oct 21 '20 10:10 a-tonchev

@a-tonchev You just saved me with this workaround! Thank you!

mathvp avatar Nov 08 '21 00:11 mathvp

The problem seems to be here. https://github.com/kutlugsahin/smooth-dnd/blob/a496ad7fbdb80b6c4ab12b2a4fe1d497b6020d32/src/styles.ts#L51

Removing only that class should be less invasive 👌🏻

ulises-jeremias avatar May 11 '22 12:05 ulises-jeremias

Alternate fix:

// Call from your drop handler.
export function cleanSmoothDnd() {
  document.body.className = document.body.className
    .split(' ')
    .filter(c => c.indexOf('dnd') < 0)
    .join(' ')
}

CharlieDigital avatar Jan 23 '23 12:01 CharlieDigital

The problem is that normal scrolling is not possible. One can only drag and drop elements only. If you try to scroll to the top or bottom it is not possible.

Akash187 avatar Jan 24 '23 10:01 Akash187

@Akash187 You're right! Simulator seems to be misleading in this case. Back to the drawing board.

CharlieDigital avatar Jan 24 '23 12:01 CharlieDigital