Option to leave items in DOM (and position with CSS)
See original GitHub issueHi, it appears that svelte-dnd-action removes elements from the DOM after drag, and it is upon the caller to recreate the list using event.detail.items, which is then rerendered by an #each block.
I have a use case with dynamic components and DOM, where I would like to allow rearranging the components, but without altering the DOM or the svelte component tree. I can do this by upating CSS, see this REPL for an example of how I do this with CSS grid.
I think this would work, but the dragged items seem to snap to particular positions (which seems to disappear if I comment out line 31), and on drop there is an error Error: Cannot read property 'parentElement' of undefined.
I know this is maybe not the usecase for your library, but I would greatly appreciate it if this could be worked out!
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (4 by maintainers)

Top Related StackOverflow Question
I thinks so. imo, you will be happy that you did long term (it is more idiomatic to how Svelte does things). I will let you know if some other solution pops in my mind.
Hmm, okay, thanks. I didn’t want to pull the state up from the panes, but I guess there is no way around it if I want to use this library.