cancel brief removal of the dragover class when the event target changes #130
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I found a small bug when animations where triggered upon adding the dragover class. As you move the mouse over child elements of the ng-file-drop element the dragleave event is fired, followed by a new dragover event. This can cause the animation attached to the dragover class to be triggered again, which is generally undesirable.
The fix is to simply tell the dragover event to cancel any pending removals of the dragover class. My fix works because the dragover event that will follow the dragleave event is already queued up to be processed after the dragleave event, and the $timout call queues up the removal of the class to happen after all pending events are processed, thus if the dragover event is in the queue it will cancel the removal of the class.
I've made a demo to try show this bug here: http://plnkr.co/QqxKMCsC3Xq6L64FWiZZ if you quickly drag file over the boxes you can often see the animated overlay bouncing/flickering (it's sometimes very subtle). here is the same demo with my changes http://plnkr.co/LXqS64wWEmyG3tD4xusT which doesn't suffer from this (NOTE: firefox seems to not have the issue, but it's visible on chrome and safari).