never have beforeChild == afterChild
when the two childs are the same (happens when dragging a small item like a title dragged over bigger ones) the logic gets confiused and can do swaps in sequence, and one can see the item starting to move in the new position, then stopping and getting back to the old one immediately. Take the child you want to move from the direction of the movement comparing the current position with the old one, eliminating the ambiguity that causes the glitch