Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce bypassActivationConstraint option #1271

Merged
merged 1 commit into from
Nov 6, 2023

Conversation

clauderic
Copy link
Owner

@clauderic clauderic commented Nov 6, 2023

Introduce bypassActivationConstraint() option for PointerSensor, MouseSensor and TouchSensor. This optional argument can be used to conditionally bypass activation constraints. An example use-case would be to bypass activation constraints when the activator event target is the activatorNode of a draggable source.

useSensor(PointerSensor, {
  activationConstraint: {
    delay: 250,
    tolerance: 5,
  },
  bypassActivationConstraint({event, activeNode}) {
    return activeNode.activatorNode.current?.contains(event.target);
  },
});

Copy link

changeset-bot bot commented Nov 6, 2023

🦋 Changeset detected

Latest commit: 88f2ed8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@dnd-kit/core Minor
@dnd-kit/modifiers Major
@dnd-kit/sortable Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@clauderic clauderic force-pushed the bypass-activation-constraints branch from 41528d1 to 88f2ed8 Compare November 6, 2023 21:46
@clauderic clauderic changed the title Introduce bypassActivationConstraints option Introduce bypassActivationConstraint option Nov 6, 2023
@clauderic clauderic merged commit bc588c7 into master Nov 6, 2023
7 of 8 checks passed
@clauderic clauderic deleted the bypass-activation-constraints branch November 6, 2023 21:50
@github-actions github-actions bot mentioned this pull request Nov 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant