Skip to content

Instantly share code, notes, and snippets.

View MrDoomBringer's full-sized avatar
🎯
Focusing

Emmanuel S. MrDoomBringer

🎯
Focusing
View GitHub Profile
@MrDoomBringer
MrDoomBringer / rockAroundAnchorsStrategy.tsx
Created May 20, 2026 07:06
Sorting strategy that supports anchored nodes
import type { SortingStrategy } from "@dnd-kit/sortable";
/**
* Custom sortable strategy where anchored items act as immovable rocks.
*
* The default `verticalListSortingStrategy` cascades every item between
* activeIndex and overIndex by one row. That's wrong when some slots are
* anchored (completed/past) those should stay put while only the movable
* slots reshuffle around them.
*