Skip to content

Commit 98c8a20

Browse files
committed
fix: infinite scroll loop after drag and drop in long command list
Long-distance drag operations (e.g., first to last item) caused auto-scroll to continue indefinitely after drop, preventing manual scrolling
1 parent 1908f7c commit 98c8a20

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

src/view/src/components/group-command-list.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,12 @@ const Items = () => {
102102
);
103103

104104
return (
105-
<DndContext collisionDetection={closestCenter} onDragEnd={handleDragEnd} sensors={sensors}>
105+
<DndContext
106+
autoScroll={false}
107+
collisionDetection={closestCenter}
108+
onDragEnd={handleDragEnd}
109+
sensors={sensors}
110+
>
106111
<SortableContext items={sortableItemIds} strategy={verticalListSortingStrategy}>
107112
<div className="space-y-3">
108113
<AnimatePresence initial={false} mode="popLayout">

src/view/src/hooks/use-sortable-list.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,12 @@ export const useSortableList = ({ items, onReorder }: UseSortableListProps) => {
5252
);
5353

5454
const SortableWrapper = ({ children }: { children: React.ReactNode }) => (
55-
<DndContext collisionDetection={closestCenter} onDragEnd={handleDragEnd} sensors={sensors}>
55+
<DndContext
56+
autoScroll={false}
57+
collisionDetection={closestCenter}
58+
onDragEnd={handleDragEnd}
59+
sensors={sensors}
60+
>
5661
<SortableContext items={items.map((item) => item.id)} strategy={verticalListSortingStrategy}>
5762
{children}
5863
</SortableContext>

0 commit comments

Comments
 (0)