ng2FileDrop directive emitting onDragLeave event if host has child DIVs #502
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
If the DIV hosting the ng2FileDrop directive has child DIV, when one drag and hover over this DIVs, the onDragLeave event is fired. It should be fired only when the drag goes outside the host element.
I've managed to solve this issue modifying the onDragLeave event for the directive:
Note that the === was replaced by !== as one should emit only when leaving the host element.
Hum, not working also. Now it does not emit when leaving the host element. dragleave event on the host is firing when dragging over the clild DIV and I can not differentiate from the real dragleave when leaving the host DIV.
Any thoughts?
Some people suggested disable the pointer events in the child DIVs and this really works:
This is not supported before IE 11.
There is a fix that could be done without using pointer-events.
You need to create a counter incrementing it on a dragenter event and decrement it on dragleave. You should fileOver.emit(false) only when the counter goes back to zero.
I have found a workaround:
HTML code:
TypeScript code: