You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you drag the item by its red drag handle, take a look at the console logs. You will see that the DndContext: onDragStart is called, but the useDndMonitor: onDragStart is not.
Workaround
I found that this issue does not occur if the collisionDetection function returns null at the start of the drag. So the workaround is to have collisionDetection always return null until DndContext: onDragStart is called. Then, after that, have the function return its regular results (i.e., closestCorners).
See the above CodeSandbox for an example of the workaround (in App.js use collisionDetection={collisionDetectionWorkaround}).
The text was updated successfully, but these errors were encountered:
Repro
DndContext
with:useSensor(PointerSensor, { activationConstraint: { distance: 10 } })
collisionDetection={closestCorners}
useDndMonitor({ onDragStart: () => console.log('useDndMonitor: onDragStart') })
useDndMonitor: onDragStart
is not logged when a drag is started.I have set up the repro in a CodeSandbox here: https://codesandbox.io/s/dnd-kit-ondragstart-bug-zysht?file=/src/App.js
When you drag the item by its red drag handle, take a look at the console logs. You will see that the
DndContext: onDragStart
is called, but theuseDndMonitor: onDragStart
is not.Workaround
I found that this issue does not occur if the
collisionDetection
function returnsnull
at the start of the drag. So the workaround is to havecollisionDetection
always returnnull
untilDndContext: onDragStart
is called. Then, after that, have the function return its regular results (i.e.,closestCorners
).See the above CodeSandbox for an example of the workaround (in
App.js
usecollisionDetection={collisionDetectionWorkaround}
).The text was updated successfully, but these errors were encountered: