svelte-dnd-action: unable to scroll on touch screen devices when the dndzone fills the page
Hi,
Touch input users are unable to scroll page when a dndzone fills it.
eg: https://www.youtube.com/shorts/mDiEBc7fLw0
Maybe an input delay would be a good workaround (you hold the item for x seconds before the drag action starts)
I tried doing it myself wrapping my dndzone in a <TouchDelayWrapper /> component made like this
<script>
let touchTimeout;
export let isDraggable = false;
function handleTouchStart() {
touchTimeout = setTimeout(() => {
isDraggable = true;
console.log('Touch hold');
}, 500);
}
function handleTouchEnd() {
clearTimeout(touchTimeout);
isDraggable = false;
}
</script>
<div
on:touchstart={handleTouchStart}
on:touchend={handleTouchEnd}
on:touchcancel={handleTouchEnd}
style="touch-action: {isDraggable ? 'none' : 'pan-y pinch-zoom'}"
>
<slot {isDraggable}></slot>
</div>
but I could not seem to find a way to update my dndzone reactively
<script>
//...bla bla bla
let parentDraggable = false;
</script>
<TouchDelayWrapper bind:isDraggable={parentDraggable}>
<!-- this updates reactively -->
<h1>{parentDraggable}</h1>
<!-- this does not -->
<div use:dndzone={{items, flipDuration, dragDisabled: !parentDraggable}}>
</div>
</TouchDelayWrapper>
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 18 (8 by maintainers)
Yes. I have my own set of examples I use to test locally but it’s not public. You can use a simple example and I will also run it through my stuff before I merge
On Thu, May 29, 2025, 07:54 Tyler Petrov @.***> wrote: