Skip to content

Check for touch-action styles before dragging#1890

Open
rjur11 wants to merge 1 commit into
clauderic:mainfrom
rjur11:feature/touch-action-detection
Open

Check for touch-action styles before dragging#1890
rjur11 wants to merge 1 commit into
clauderic:mainfrom
rjur11:feature/touch-action-detection

Conversation

@rjur11

@rjur11 rjur11 commented Feb 12, 2026

Copy link
Copy Markdown
Contributor

Adds touch-action CSS detection to PointerSensor's default preventActivation function. Only allows touch-based dragging when touch-action: none is set, preventing activation attempts that the browser would cancel for scroll/gesture handling.

@changeset-bot

changeset-bot Bot commented Feb 12, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 8e3f05e

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

This PR includes changesets to release 9 packages
Name Type
@dnd-kit/dom Patch
@dnd-kit/abstract Patch
@dnd-kit/collision Patch
@dnd-kit/geometry Patch
@dnd-kit/helpers Patch
@dnd-kit/react Patch
@dnd-kit/state Patch
@dnd-kit/vue Patch
@dnd-kit/solid Patch

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

@pkg-pr-new

pkg-pr-new Bot commented Feb 13, 2026

Copy link
Copy Markdown

Open in StackBlitz

@dnd-kit/abstract

npm i https://pkg.pr.new/clauderic/dnd-kit/@dnd-kit/abstract@1890

@dnd-kit/collision

npm i https://pkg.pr.new/clauderic/dnd-kit/@dnd-kit/collision@1890

@dnd-kit/dom

npm i https://pkg.pr.new/clauderic/dnd-kit/@dnd-kit/dom@1890

@dnd-kit/geometry

npm i https://pkg.pr.new/clauderic/dnd-kit/@dnd-kit/geometry@1890

@dnd-kit/helpers

npm i https://pkg.pr.new/clauderic/dnd-kit/@dnd-kit/helpers@1890

@dnd-kit/react

npm i https://pkg.pr.new/clauderic/dnd-kit/@dnd-kit/react@1890

@dnd-kit/solid

npm i https://pkg.pr.new/clauderic/dnd-kit/@dnd-kit/solid@1890

@dnd-kit/state

npm i https://pkg.pr.new/clauderic/dnd-kit/@dnd-kit/state@1890

@dnd-kit/svelte

npm i https://pkg.pr.new/clauderic/dnd-kit/@dnd-kit/svelte@1890

@dnd-kit/vue

npm i https://pkg.pr.new/clauderic/dnd-kit/@dnd-kit/vue@1890

commit: 8e3f05e

@clauderic clauderic closed this Feb 16, 2026
@clauderic clauderic reopened this Feb 16, 2026
@clauderic clauderic changed the base branch from experimental to main February 16, 2026 02:23

@clauderic clauderic left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

This PR adds a check in PointerSensor.preventActivation that prevents touch-based drag from starting if the activator element doesn't have touch-action: none set. The intent is to avoid attempting drags that the browser would cancel due to scroll/gesture handling.

Feedback

Suggestions

  • PointerSensor.ts:76-83 — This change silently disables touch dragging for any user who hasn't explicitly set touch-action: none on their draggable elements. Existing users who currently have touch dragging working (perhaps relying on the browser tolerating the conflict) will find touch dragging silently broken after upgrading. This may be more impactful than a patch warrants, and could benefit from documentation (e.g., a note in the migration guide or in the JSDoc for preventActivation) explaining the requirement.
  • Consider whether the check should look at the element under the pointer (event.target) in addition to or instead of the activator, since a parent element with touch-action: auto can still intercept touch events even if the draggable has touch-action: none.
  • Minor: the trailing whitespace removal in activationConstraints is a nice cleanup but slightly noisy in the diff.

Changeset

  • Status: present, bump type patch for @dnd-kit/dom — correct for this kind of behavioral fix.

Overall

The underlying motivation is solid — trying to drag without touch-action: none leads to unreliable behavior on mobile, and detecting this upfront is cleaner than a silent failure. The potential for silent regressions in existing setups is worth flagging for @clauderic to consider before merging. Thanks for contributing this, @rjur11!


[claude-review]

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.

2 participants