Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to master, this PR will be updated.
Releases
@dnd-kit/core@4.0.0
Major Changes
#337
05d6a78
Thanks @clauderic! - React updates in non-synthetic event handlers are now batched to reduce re-renders and prepare for React 18.Also fixed issues with collision detection:
#427
f96cb5d
Thanks @clauderic! - - Using transform-agnostic measurements for the DragOverlay node.overlayNode
property todragOverlay
on theDndContextDescriptor
interface.#372
dbc9601
Thanks @clauderic! - RefactoredDroppableContainers
type fromRecord<UniqueIdentifier, DroppableContainer
to a custom instance that extends theMap
constructor and adds a few other methods such astoArray()
,getEnabled()
andgetNodeFor(id)
.A unique
key
property was also added to theDraggableNode
andDroppableContainer
interfaces. This prevents potential race conditions in the mount and cleanup effects ofuseDraggable
anduseDroppable
. It's possible for the clean-up effect to run after another React component usinguseDraggable
oruseDroppable
mounts, which causes the newly mounted element to accidentally be un-registered.#379
8d70540
Thanks @clauderic! - ThelayoutMeasuring
prop ofDndContext
has been renamed tomeasuring
.The options that could previously be passed to the
layoutMeasuring
prop now need to be passed as:The
LayoutMeasuring
type has been renamed toMeasuringConfiguration
. TheLayoutMeasuringStrategy
andLayoutMeasuringFrequency
enums have also been renamed toMeasuringStrategy
andMeasuringFrequency
.This refactor allows consumers to configure how to measure both droppable and draggable nodes. By default,
@dnd-kit
ignores transforms when measuring draggable nodes. This beahviour can now be configured:#350
a13dbb6
Thanks @wmain! - Breaking change: TheCollisionDetection
interface has been refactored. It now receives an object that contains theactive
draggable node, along with thecollisionRect
and an array ofdroppableContainers
.If you've built custom collision detection algorithms, you'll need to update them. Refer to this PR for examples of how to refactor collision detection functions to the new
CollisionDetection
interface.The
sortableKeyboardCoordinates
method has also been updated since it relies on theclosestCorners
collision detection algorithm. If you were using collision detection strategies in a customsortableKeyboardCoordinates
method, you'll need to update those as well.Minor Changes
#334
13be602
Thanks @trentmwillis! - Now passingactivatorEvent
as an argument tomodifiers
#376
aede2cc
Thanks @clauderic! - Mouse, Pointer, Touch sensors now cancel dragging on visibility change and window resize. The Keyboard sensor already cancelled dragging on window resize. It now also cancels dragging on visibility change.#399
a32a4c5
Thanks @supersebh! - Added support fortolerance
in DistanceConstrain. As soon as thetolerance
is exceeded, the drag operation will be aborted, unless it has already started (because distance criteria was met).Example usage:
Be careful not to pick conflicting settings for distance and tolerance if used together. For example, picking a tolerance that is lower than the distance in the same axis would result in the activation constraint never being met.
#408
dea715c
Thanks @wmain! - The collision rect is now completely based on the position of theDragOverlay
when it is used. Previously, only thewidth
andheight
properties of theDragOverlay
were used for the collision rect, while thetop
,left
,bottom
andright
properties were derived from the active node rect. This new approach is more aligned with developers would expect, but could cause issues for consumers that were relying on the previous (incorrect) behavior.#433
c447880
Thanks @clauderic! - Fix unwanted animations when items in sortable context change#415
2ba6dfe
Thanks @cantrellnm! - PreventgetScrollableAncestors
from continuing to search if a fixed position node is found.#377
422d083
Thanks @clauderic! - Pointer, Mouse and Touch sensors now stop propagation of click events once activation constraints are met.#375
c4b21b4
Thanks @clauderic! - Prevent context menu from opening when pointer sensor is active5a41340
Thanks @clauderic! - Pointer, Mouse and Touch sensors now prevent selection changes and clear any existing selection ranges once activation constraints are met.e2ee0dc
Thanks @clauderic! - Reset theover
internal state of<DndContext />
on drop.1fe9b5c
Thanks @clauderic! - Sensors may now specify a staticsetup
method that will be invoked when<DndContext>
mounts. The setup method may optionally also return a teardown function that will be invoked when the<DndContext>
associated with that sensor unmounts.Patch Changes
#430
46ec5e4
Thanks @clauderic! - Fix duplicate scroll ancestor detection. In some scenarios, an element could be added twice to the list of detected scrollable ancestors, resulting in invalid offsets.#371
7006464
Thanks @clauderic! - fix: do not wrap consumer-defined handlers in batchedUpdates1fe9b5c
Thanks @clauderic! - The TouchSensor attempts to prevent the default browser behavior of scrolling the page by callingevent.preventDefault()
in thetouchmove
event listener. This wasn't working in iOS Safari due to a bug with dynamically attachedtouchmove
event listeners. Adding a non-passive, non-capturetouchmove
event listener before dynamically attaching othertouchmove
event listeners solves the issue.Updated dependencies [
0e628bc
,13be602
,1f5ca27
]:@dnd-kit/sortable@5.0.0
Major Changes
#427
f96cb5d
Thanks @clauderic! - - Using transform-agnostic measurements for the DragOverlay node.overlayNode
property todragOverlay
on theDndContextDescriptor
interface.9cfac05
Thanks @clauderic! - Renamed thewasSorting
property towasDragging
on theSortableContext
andAnimateLayoutChanges
interfaces.Minor Changes
c447880
Thanks @clauderic! - Fix unwanted animations when items in sortable context changePatch Changes
#372
dbc9601
Thanks @clauderic! - RefactoredDroppableContainers
type fromRecord<UniqueIdentifier, DroppableContainer
to a custom instance that extends theMap
constructor and adds a few other methods such astoArray()
,getEnabled()
andgetNodeFor(id)
.A unique
key
property was also added to theDraggableNode
andDroppableContainer
interfaces. This prevents potential race conditions in the mount and cleanup effects ofuseDraggable
anduseDroppable
. It's possible for the clean-up effect to run after another React component usinguseDraggable
oruseDroppable
mounts, which causes the newly mounted element to accidentally be un-registered.#350
a13dbb6
Thanks @wmain! - Breaking change: TheCollisionDetection
interface has been refactored. It now receives an object that contains theactive
draggable node, along with thecollisionRect
and an array ofdroppableContainers
.If you've built custom collision detection algorithms, you'll need to update them. Refer to this PR for examples of how to refactor collision detection functions to the new
CollisionDetection
interface.The
sortableKeyboardCoordinates
method has also been updated since it relies on theclosestCorners
collision detection algorithm. If you were using collision detection strategies in a customsortableKeyboardCoordinates
method, you'll need to update those as well.86d1f27
Thanks @clauderic! - Fixed a bug in thehorizontalListSortingStrategy
where it did not check if thecurrentRect
was undefined.e42a711
Thanks @clauderic! - Fixed a bug with the default layout animation function where it could returntrue
initially even if the list had not been sorted yet. Now checking thewasDragging
property to ensure no layout animation occurs ifwasDragging
is false.#341
e02b737
Thanks @clauderic! - Returnundefined
instead ofnull
fortransition
inuseSortable
Updated dependencies [
13be602
,aede2cc
,05d6a78
,a32a4c5
,f96cb5d
,dea715c
,dbc9601
,46ec5e4
,7006464
,0e628bc
,c447880
,2ba6dfe
,8d70540
,13be602
,422d083
,c4b21b4
,5a41340
,a13dbb6
,e2ee0dc
,1fe9b5c
,1fe9b5c
,1f5ca27
]:@dnd-kit/utilities@3.0.0
Major Changes
1f5ca27
Thanks @clauderic! - Added react to peerDependencies of @dnd-kit/utilitiesMinor Changes
13be602
Thanks @trentmwillis! - MoveCoordinates
interface along withgetEventCoordinates
,isMouseEvent
andisTouchEvent
helpers to @dnd-kit/utilitiesPatch Changes
0e628bc
Thanks @chestozo! - Added PointerEvent support to thegetEventCoordinates
method. This fixes testing the PointerSensor with Cypress (getEventCoordinates
does not support pointer events #436)@dnd-kit/modifiers@4.0.0
Minor Changes
13be602
Thanks @trentmwillis! - AddsnapCenterToCursor
modifierPatch Changes
#437
0e628bc
Thanks @chestozo! - Added PointerEvent support to thegetEventCoordinates
method. This fixes testing the PointerSensor with Cypress (getEventCoordinates
does not support pointer events #436)Updated dependencies [
13be602
,aede2cc
,05d6a78
,a32a4c5
,f96cb5d
,dea715c
,dbc9601
,46ec5e4
,7006464
,0e628bc
,c447880
,2ba6dfe
,8d70540
,13be602
,422d083
,c4b21b4
,5a41340
,a13dbb6
,e2ee0dc
,1fe9b5c
,1fe9b5c
,1f5ca27
]: