Skip to content

Commit bcbae14

Browse files
Always call preventDefault in drop handler
1 parent 96d4aec commit bcbae14

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

angular-drag-and-drop-lists.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,10 @@ angular.module('dndLists', [])
296296

297297
if (!isDropAllowed(event)) return true;
298298

299+
// The default behavior in Firefox is to interpret the dropped element as URL and
300+
// forward to it. We want to prevent that even if our drop is aborted.
301+
event.preventDefault();
302+
299303
// Unserialize the data that was serialized in dragstart. According to the HTML5 specs,
300304
// the "Text" drag type will be converted to text/plain, but IE does not do that.
301305
var data = event.dataTransfer.getData("Text") || event.dataTransfer.getData("text/plain");
@@ -332,7 +336,6 @@ angular.module('dndLists', [])
332336

333337
// Clean up
334338
stopDragover();
335-
event.preventDefault();
336339
event.stopPropagation();
337340
return false;
338341
});

angular-drag-and-drop-lists.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)