Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drag freezes when originally dragged element is removed from DOM #143

Closed
cibernox opened this issue Oct 16, 2018 · 6 comments
Closed

Drag freezes when originally dragged element is removed from DOM #143

cibernox opened this issue Oct 16, 2018 · 6 comments

Comments

@cibernox
Copy link

I observe this in iOS safari, as every other browser I support has native Drag & Drop.

This is how this works in desktop and chrome for android.

dnd-working

In safari I can use drag and drop to sort within the same list (drop-area) but if fails if I trans to drag from one area to another one.

dnd-iphone-bug

If I inspect the logs, when the drag freezes I can see in the console some messages looping for ever. They don't stop, no matter what I do or where I click:

[Log] dnd-poly: d'n'd iteration ended. current drag operation: move (vendor.js, line 51807)
[Log] dnd-poly: dispatching drag (vendor.js, line 51514)
[Log] dnd-poly: new immediate user selection is: [object HTMLLIElement] (vendor.js, line 51761)
[Log] dnd-poly: dispatching dragover (vendor.js, line 51514)
[Log] dnd-poly: dragover prevented. (vendor.js, line 51803)
[Log] dnd-poly: d'n'd iteration ended. current drag operation: move (vendor.js, line 51807)
[Log] dnd-poly: dispatching drag (vendor.js, line 51514)
[Log] dnd-poly: new immediate user selection is: [object HTMLLIElement] (vendor.js, line 51761)
[Log] dnd-poly: dispatching dragover (vendor.js, line 51514)
[Log] dnd-poly: dragover prevented. (vendor.js, line 51803)
[Log] dnd-poly: d'n'd iteration ended. current drag operation: move (vendor.js, line 51807)
...
@reppners
Copy link
Collaborator

Hi and sorry for the long delay. Can you provide me a git repo or stackblitz/plunkr which reproduces the problem so I can take a look and play with it?

@AtanasChachev
Copy link

AtanasChachev commented Aug 16, 2019

Hey @reppners I've created a simple demo where you can reproduce this issue. Steps to reproduce:

  1. Open https://angular-jxj2v4.stackblitz.io from the mobile safari.
  2. Start dragging some element named 'Initial_...' and enter the top div named '3ENTER HERE WITH ELEMENT WHO IS BEING DRAGGED'.

Expected behaviour : The elements are updated and the drag and drop can be used again.
Actual behaviour: The elements are updated but the dragged element 'freezes' and the drag and drop is disabled, If you try to drag and drop again, it won't work.

You can see the codebase here: https://stackblitz.com/edit/angular-jxj2v4

Would be great and helpful for the community if this one gets some solution.
Thanks in advance!

At all , when the view/data is being updated while dragging some element the element itself freezes and the drag in drop is being disabled.

@reppners
Copy link
Collaborator

Thanks for providing a reproduction, I'll try to track down the root cause.

@reppners
Copy link
Collaborator

reppners commented Aug 25, 2019

I'm a bit uncertain on how to workaround this if even possible.

See

Edit: Chrome and Firefox show the same behaviour in mobile emulation mode.

@reppners reppners changed the title Drag freezes when hovering a different drag zone Drag freezes when originally dragged element is removed from DOM Aug 26, 2019
@AtanasChachev
Copy link

AtanasChachev commented Aug 28, 2019

Hey @reppners I found a workaround which fits my case. Instead of updating the existing elements (destroying the element that is being dragged), I've created 2 components with the same elements (second components is with the updated data elements which the dragged element from component 1 can be dropped onto them) and just toggling the visibility with [hidden] attribute. This way the dragged element is not being destroyed but instead hidden and everything works perfectly. Not the brightest solution but it works perfectly :)

@reppners
Copy link
Collaborator

Closing as non-actionable on the library level but workarounds can be made at application level 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants