github clauderic/dnd-kit @dnd-kit/dom@0.2.0

latest releases: @dnd-kit/dom@0.2.1, @dnd-kit/state@0.2.1, @dnd-kit/collision@0.2.1...
one day ago

Minor Changes

  • #1821 e95a9c8 Thanks @clauderic! - - Refactor PointerSensor to use the new activation primitives.

    • Add PointerActivationConstraints with composable constraints:
      • PointerActivationConstraints.Delay({value, tolerance})
      • PointerActivationConstraints.Distance({value, tolerance?})
    • Update PointerSensor.defaults.activationConstraints(...):
      • Mouse on handle: activates immediately.
      • Touch: Delay 250ms with 5px tolerance.
      • Text inputs: Delay 200ms with 0px tolerance.
      • Other pointer types: Delay 200ms with 10px tolerance + Distance 5px.
    • New utilities:
      • getDocuments() returns all same-origin documents (enables listening across iframes).
      • getEventCoordinates(event) returns {x, y} from a PointerEvent.
    • PointerSensor now binds listeners across same-origin documents and improves default prevention during drag.
    • Internal cleanups: remove internal sensors/pointer/index.ts and utilities/execution-context/index.ts (no public API impact).

    These changes are additive and should be non-breaking. If you were composing pointer activation constraints, migrate to the new PointerActivationConstraints classes if you were importing internal implementations.

  • #1823 9849887 Thanks @github-actions! - - Add preventActivation option to PointerSensor and KeyboardSensor to conditionally prevent sensor activation.

    • PointerSensor: The default preventActivation prevents activation when the pointer target is an interactive element (input, select, textarea, button, link, or contenteditable) that is not the source element or handle.
    • KeyboardSensor: Renamed shouldActivate to preventActivation with inverted logic—return true to prevent activation instead of returning true to allow it.
    • New utility: isInteractiveElement(element) checks if an element is an interactive form control or link.

Patch Changes

  • Updated dependencies [e95a9c8]:
    • @dnd-kit/abstract@0.2.0
    • @dnd-kit/collision@0.2.0
    • @dnd-kit/geometry@0.2.0
    • @dnd-kit/state@0.2.0

Don't miss a new dnd-kit release

NewReleases is sending notifications on new releases.