[bug] Sortable: uncontrolled scroll to the bottom if any element picked in the middle or close to the bottom of a scrollable list (mobile only).
Repro: https://jsfiddle.net/tgvcvpy0/11/ Affected browsers: mobile FireFox and mobile Chrome on Android; Chrome on Linux/MacOS in mobile mode (responsive) Tested version: current 1.0.0 beta, off CDN per instructions in the readme.
Steps:
- Please open the link https://jsfiddle.net/tgvcvpy0/11/ in Chrome.
- Switch Chrome into mobile mode and select responsive layout. Alternatively, test it on an Android device.
- Scroll to the middle of the large list.
- Pick any element to initiate dragging and observe that the whole list is being scrolled down despite the cursor staying in the middle of the area.
Thanks for reporting! The latest beta introduced the AutoScroll plugin, which takes care of auto scrolling, but it came with some bugs.
We have since added some improvements, which will get rid of the behaviour you are describing. It also renames the plugin from AutoScroll to Scrollable. These changes will be released with the next beta (beta.5).
I'll comment in this issue once the new release is out.
The only workaround at the moment is removing the AutoScroll plugin:
import {Sortable, Draggable} from '@shopify/draggable';
const sortable = new Sortable(containers, {
/* ... */
})
// Removes the auto scroll plugin
sortable.removePlugin(Draggable.Plugins.AutoScroll);
Hope this helps
Thank you, Max! I truly appreciate your response. Unfortunately, I was able to reproduce it even after the removal of the AutoScroll plugin.
Indeed, initially it appeared as if it fixed it. But then I figured it out that all it took was to drag the first element to the bottom of the list the regular legit way (by moving the element closer to the bottom). Starting from that point, any element from the second half of the list would again start causing the autoscroll of the list to the bottom disregarding the position of the cursor.
I'll be happy to retest the next version you have on my Android device again!
Sincerely, yours long huge fan!
I'm also running into an issue where dragging an item causes the page to scroll down to the bottom, and the item becomes offset from the touch point:
Here's a video of the problem: https://www.dropbox.com/s/nv02en0zb4iwrqp/draggable-issue.mp4?dl=0
And here's the live site where the screen-recording was made: http://fiery-quilt.cloudvent.net/
I tried to remove the auto scroll plugin, but was unsuccessful. Based on how I'm initializing Draggable, can you tell me how I should remove the auto-scroll plugin?
new window.Draggable.Sortable(document.querySelectorAll('.item_accessories'), {
draggable: '.item_accessory_image'
})
@WillAvudim @bzle We released beta.5, which includes improvements to Scrollable (previously called AutoScroll), could you give it a try and report back?
Most of the issues you mentioned should be resolved now
Thank you, Max! It works flawlessly now. I noticed some artifacts in behavior when I switch between mobile/desktop mode, however if I reload the screen straight in the mobile mode, everything just works. The only issue I have noticed in the mobile mode was that if I clicked on the item and did not attempt to move it anywhere, then in about a second the browser menu appeared along with the console message:
draggable.bundle.js:5837 [Intervention] Ignored attempt to cancel a touchcancel event with cancelable=false, for example because scrolling is in progress and cannot be interrupted.
- Please open https://jsfiddle.net/dczrfrgx/1/ in Chrome.
- Switch Chrome to iPhone 7 mode.
- Reload the whole thing.
- Click on any item and wait for a second.
It sometimes doesn't reproduce for the first click, so try clicking another item(s) and wait for a second. You'll see that at some point it starts invoking the browser's menu along with the warning in the console output. Although, it's hard for me to conclude whether this behavior is undesirable.
@tsov The update resolved the scrolling issue I was experiencing!
Great to hear @WillAvudim @bzle !
@WillAvudim interesting, I will investigate this shortly! Would you mind creating a new issue so I can close this one down? Or do you think it has something to do with Scrollable ?
Thanks again for your contributions guys 👍
@tsov Absolutely, opened https://github.com/Shopify/draggable/issues/171
Once again, truly appreciate all the work you've put into resolving this issue!
@WillAvudim Cheers 👍Will check it out soon. Closing this issue for now