From d52b1bca85f9e0cf43394a667809b83261373571 Mon Sep 17 00:00:00 2001 From: Ali Bosworth Date: Fri, 1 Apr 2016 17:03:44 -0400 Subject: [PATCH] Defer mouseOut cleanup slightly to avoid issue on Windows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When a browser is “maximized” on Windows, a mouseout event is triggered immediately before the drop event, causing the cleanup code to fire and we miss the drop event. --- src/droppable.coffee | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/droppable.coffee b/src/droppable.coffee index 603da3c..0189320 100644 --- a/src/droppable.coffee +++ b/src/droppable.coffee @@ -69,9 +69,15 @@ class Droppable extends DragAndDrop @_cleanUp() _handleWindowMouseout: normalizeEventCallback (e, dataTransfer) -> + # TODO: This will bubble up and happen any time the mouse leaves any element $(@el).removeClass(@options.hoverClass) if @options.hoverClass @options.out?(e, @el, typesForDataTransfer(dataTransfer)) - @_cleanUp() + + # HACK: Maximized Chrome on Windows triggers a mouseout right before drop + # so deferring the cleanup slightly allows the drop to be captured + setTimeout( => + @_cleanUp() + , 50) _handleDragleave: normalizeEventCallback (e, dataTransfer) -> # HACK some UA fires drag leave too often, we need to make sure it’s