question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pointer drag and drop issue with expanded item

See original GitHub issue

In my interface, I have an expansion panel component that can be expanded/collapsed that I am now using svelte-dnd-action to reorder.

If the panel not expanded, dnd works great, but as soon as I try to drag a panel that is open, it disappears (either immediate when dragging, or after being dropped):

https://user-images.githubusercontent.com/177476/107232425-62c35200-69ef-11eb-9719-b93c4c5e7056.mp4

If I keep trying to drag a few, at some point this error shows up in the console as well:

image

What’s surprising is keyboard interaction works as expected with an expanded item:

https://user-images.githubusercontent.com/177476/107232701-b635a000-69ef-11eb-8d21-cf504adeb172.mp4

I tried to create minimal reproduction of the issue but I haven’t been able to just yet (I’ll keep trying), although there is one oddity in the current example: If the item is “expanded” and you drag it, it resizes back to “collapsed”, although it doesn’t disappear like in my case. It appears the internal state of the component is lost/reset when it is dnd but not with keyboard interactions.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
isaacHagoelcommented, Feb 9, 2021

Good luck! This library seems to use the native drag and drop api which i was actively trying to avoid 😃 I think your internal state will still not persist if svelte re renders the component for any reason. Let me know if i can be of further assistance.

On Wed, Feb 10, 2021, 07:12 Sean Lynch notifications@github.com wrote:

Looks like SortableJS https://sortablejs.github.io/Sortable/ works this way, and I was able to setup a quick REPL https://svelte.dev/repl/bb527bb8a2f849e19cd5956fc76bb668?version=3.32.2 that leverages slots and transitions and doesn’t loose the internal state. I need to kick it around a little more but appears to handle all my needs thus far.

Thanks again for your time investigating this. I think I’m going to investigate using SortableJS in an action / component.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/isaacHagoel/svelte-dnd-action/issues/247#issuecomment-776212992, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE4OZC4AEPMEGR6AQXRWN4DS6GJLVANCNFSM4XJFLT2Q .

1reaction
isaacHagoelcommented, Feb 8, 2021

Keyboard ‘dragging’ has no intermediary states and no shadow items. It is much simpler.

On Tue, Feb 9, 2021, 06:43 Sean Lynch notifications@github.com wrote:

@isaacHagoel https://github.com/isaacHagoel Thanks for the info. Let me dig in a little more tonight and see if I can reproduce it in the REPL.

One curiosity, the issue is not present (and state maintained) when using the keyboard to move items. I assume this is handled differently intentionally?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/isaacHagoel/svelte-dnd-action/issues/247#issuecomment-775395494, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE4OZC2YPMBH2WU2UU2JF5DS6A5FJANCNFSM4XJFLT2Q .

Read more comments on GitHub >

github_iconTop Results From Across the Web

IE11 Drag And Drop change the cursor pointer on drag
I want to know because I'm moving this element, and am having a problem with WYSIWYG dragEnd since I'm positioning this x/left and...
Read more >
Fix problem: Drag and drop not working in Windows
Drag and drop is no longer working in Windows 10 or Windows 11? Here's how to fix this problem in just a couple...
Read more >
Drag'n'Drop with mouse events - The Modern JavaScript Tutorial
The problem is that, while we're dragging, the draggable element is always above other elements. And mouse events only happen on the top ......
Read more >
Drag–and–Drop: How to Design for Ease of Use
First, make sure that your handle icon is keyboard accessible with the Tab key; this enables “grabbing” the draggable item via the spacebar....
Read more >
Drag and Drop - Structure for Jira (Cloud)
To grab an item, move your mouse pointer over the Drag and Drop Handle, at the far left of the item's row. Press...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found