bevacqua / dragula

:ok_hand: Drag and drop so simple it hurts
https://bevacqua.github.io/dragula/
MIT License
22.01k stars 1.97k forks source link

Unexpected triggering of on("out") #513

Closed ghost closed 4 years ago

ghost commented 7 years ago

On "dragend", "out" gets triggered, even also if 'el' never gets dragged out of 'source'. Is this a faulty behavior or am I just don't getting the purpose of it?

https://jsfiddle.net/43shxLk0/

Background: I have container with elements which must be removed on spill, but the remove must be confirmed. The "remove" event is not an option, because if the confirmation failed, I would need to reload the window. Therefore, I intended to add the class "remove" to 'el' on "out" and remove this class on "over" (this class will also turn 'el' and the mirror red for better visualisation). On "draggend", I check whether 'el' has class "remove" and if so a confirmation message will be fired. However, as "out" gets fired every time on "dragend", this doesn't work at all.