Closed mtraynham closed 6 years ago
I'm not exactly sure but the stopPropagation() could be there to support nesting drop zones. Need to check that, but I'm pretty sure there is way to enable nesting dropzones and letting the event bubble up.
@reppners thanks for the clarification, you're probably right. Could we instead have a flag or options object that allowed bubbling?
If there is no other way to make nested dropzones work we can introduce an API to explicitly enable/disable event bubbling but lets check first if there is another way to nest dropzones with event bubbling being the default.
Using https://developer.mozilla.org/en-US/docs/Web/API/Event/defaultPrevented should do the trick.
Not sure I completely follow, are you suggesting we could just bail out of the drop @HostListener's if it was already prevented by a nested component?
Yes, basically early exit in a parent dropzone handler when a child dropzone invoked preventDefault()
@reppners Hey man, I finally got around to getting your suggestion in (and rebased against master). I think that should handle it, but I haven't tried it yet.
@mtraynham Small change and well documented, thanks! I'll try to review this week 👍
All working as intended! Thanks for your contribution 👍
Some scrollbar libraries support scrolling on
dragover
. This component is stopping the propagation of that event, so I've simply removed thestopPropagation
to allow that event to bubble up. I checked angular-drag-and-drop-lists and it looks like this samestopPropagation
has been there since the beginning. I don't believe that it's entirely necessary to stop these events if they've been handled by the component, e.g. preventing it from bubbling up.