Skip to content

Sortable - Simple

React DnD's sortable recipe. Each card is both a BdndDraggable and a BdndDropTarget. While dragging, the OnHover handler measures the hovered card (BdndInterop.GetBoundingClientRectAsync), compares the pointer (Monitor.GetClientOffset()) against its midpoint and reorders the list live. Reordering happens during hover, not on drop. The keyboard reorders the same way - Space on a card, then each arrow key moves it one place - because a keyboard drag runs OnHover as it moves too. The list itself is a drop target as well, so the gaps between the cards are no "no-drop" zones. For most lists the drop indicators page shows a simpler way, which measures nothing.

Write the docs
Review the PR
Ship the release
Celebrate
Sleep

Order: Write the docs, Review the PR, Ship the release, Celebrate, Sleep

An unhandled error has occurred. Reload 🗙