reppners / ngx-drag-drop

Angular directives using the native HTML Drag And Drop API
https://reppners.github.io/ngx-drag-drop/
BSD 3-Clause "New" or "Revised" License
299 stars 118 forks source link

nested example problem #50

Closed davidlaredodiaz closed 1 year ago

davidlaredodiaz commented 5 years ago

Describe the bug In nested example if we drag 'Got something nested' and drop inside itself, below 'MY_CUSTOM_DRAG_IMAGE' text, will disappear.

Steps to reproduce the behavior:

  1. Go to 'https://reppners.github.io/ngx-drag-drop/'.
  2. Click on 'Nested' tab.
  3. Drag 'Got something nested' node.
  4. drop inside itself, below ' MY_CUSTOM_DRAG_IMAGE' text.

Expected behavior The Draggged & dropped 'Got something nested' node it would keep without any change.

reppners commented 5 years ago

Hi 👋 thanks for providing reproduction steps.

It's not a bug it's a feature 🤣

Jokes aside, you are right that it's unexpected behavior and should be improved. It's not strictly a bug because the logic works as expected but rather incomplete implementation of the demo. The recursive nature makes it non-trivial to handle drops of a parent in one of the nested children.

I'll look into how the demo can handle this special case so it can serve as example.

LuukEbenau commented 4 years ago

I got the same problem, and wonder if someone already found a elegant solution to this problem? since its about a year ago now.

cihanselim commented 4 years ago

Hi. I found a solution to avoid that bug. Actually a trick, more than a solution :)

.dndDraggingSource { display: none; }

This style hide your dragging item (with its children) so you cannot drag holding item to its children list.

reppners commented 4 years ago

@chnselim good idea! It might be worthwile to try pointer-events:none; style.

ChristofFritz commented 1 year ago

Stale issue (and probably fixed by now)