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)

Most upvoted comments

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:

Tyler-Petrov left a comment (isaacHagoel/svelte-dnd-action#613) https://github.com/isaacHagoel/svelte-dnd-action/issues/613#issuecomment-2917703097

I forked your repo, but I didn’t notice any way to test it locally while I develop. What’s your work flow? Should I add a small sveltekit app as well so testing is easier for others who are looking to contribute? I was thinking of something along the lines of sveltekit-superforms https://github.com/ciscoheat/sveltekit-superforms/tree/main/src.

P.S. I’m not trying to take over the development workflow in any way, but I’m just curious and offering options that make sense to me. I’d love to hear your thoughts

— Reply to this email directly, view it on GitHub https://github.com/isaacHagoel/svelte-dnd-action/issues/613#issuecomment-2917703097, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE4OZC7GGBY72XKS7EUKHCT3AYWCFAVCNFSM6AAAAABRVA5MVCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDSMJXG4YDGMBZG4 . You are receiving this because you commented.Message ID: @.***>