Skip to content

Commit 93e4edc

Browse files
committed
Cancel drop event to prevent browser navigation
Firefox attempts navigation to the domain represented by the task list item text. Once we've determined the drop event is a task list item dropping onto a task list, cancel any default browser behavior and handle the event locally. If the drop event is for something other than a list item, ignore it and allow the browser or another upstream event listener to handle it.
1 parent 5aece37 commit 93e4edc

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/sortable.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ function onDrop(event: DragEvent) {
120120
// Allow dragging task list item, not text, links, or files.
121121
if (!state) return
122122

123+
event.preventDefault()
124+
event.stopPropagation()
125+
123126
const dropzone = event.currentTarget
124127
if (!(dropzone instanceof Element)) return
125128

0 commit comments

Comments
 (0)