SortableJS / Sortable

Reorderable drag-and-drop lists for modern browsers and touch devices. No jQuery or framework required.
https://sortablejs.github.io/Sortable/
MIT License
29.78k stars 3.7k forks source link

Position relative causes lag on mobile due to touch even listeners not being passive #2353

Closed hfcRed closed 3 months ago

hfcRed commented 9 months ago

Putting position: relative, position: absolute, position: fixed or transforms of any kind on any element in the DOM can sometimes cause the touchmove event from the document to cascade onto the element and unrelated elements, which causes significant performance drops when scrolling on mobile, especially on Chrome.

chrome_wZ1pFnD3Ht

The performance drop can be resolved by setting the touchmove to be passive rather than blocking. I have looked through the documentation and could not find a setting for changing the event handler to passive or opting out of event handlers all together (I do not need any for my usecase).

Am I overlooking something? Is there an easy fix for this?

owen-m1 commented 8 months ago

@hfcRed Currently no events are set as passive, we also sometimes do call preventDefault inside these functions so it may not work. Would you be able to provide a minimal reproduction so I can investigate further, thank you