Skip to content

Commit 9f7217e

Browse files
Update drag-sort.ts
1 parent 264d621 commit 9f7217e

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

addon/services/drag-sort.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,12 @@ export default class DragSort extends Service.extend(EventedMixin) {
161161
const group = this.group;
162162
const draggedItem = this.draggedItem;
163163

164-
if (sourceList !== targetList || sourceIndex !== targetIndex) {
164+
// Only perform action if targetIndex was set (meaning dragover/dragenter occurred)
165+
// and the position actually changed
166+
if (
167+
targetIndex !== null &&
168+
(sourceList !== targetList || sourceIndex !== targetIndex)
169+
) {
165170
// Account for dragged item shifting indexes by one
166171
if (sourceList === targetList && targetIndex > sourceIndex) targetIndex--;
167172

0 commit comments

Comments
 (0)