Skip to content

Treat pen pointers as touch and prevent browser gestures for block touches#15

Merged
flooryyyy merged 1 commit intomainfrom
codex/fix-touch-interaction-for-shapes-and-blocks
Apr 5, 2026
Merged

Treat pen pointers as touch and prevent browser gestures for block touches#15
flooryyyy merged 1 commit intomainfrom
codex/fix-touch-interaction-for-shapes-and-blocks

Conversation

@flooryyyy
Copy link
Copy Markdown
Owner

Motivation

  • Support pointer devices that behave like touch (e.g. stylus/pen) so touch gestures work for more pointer types.
  • Ensure React Flow node interactions (drag/resize) on touch-like devices aren't intercepted by the browser's gesture handling.
  • Broaden pointer filtering to avoid ignoring valid touch-like input while keeping non-touch pointers out of touch handlers.

Description

  • Added TOUCH_LIKE_POINTER_TYPES and isTouchLikePointer to treat "touch" and "pen" as touch-like pointer types.
  • Replaced direct event.pointerType === "touch" checks with isTouchLikePointer in onPointerDownCapture, onPointerMoveCapture, and endTrackedTouch.
  • When a touch on a non-pane block intent is detected, call event.preventDefault() to stop the browser from claiming scroll/zoom gestures so node drag/resize works.
  • Updated callback dependency arrays to include isTouchLikePointer where appropriate.

Testing

  • Ran the unit test suite with yarn test, and all tests passed.
  • Ran TypeScript type checks with tsc --noEmit, and no type errors were reported.
  • Ran the app locally to validate touch and pen interactions on a device/emulator, and gestures behaved as expected.

Codex Task

@flooryyyy flooryyyy merged commit 91be8e0 into main Apr 5, 2026
4 checks passed
@flooryyyy flooryyyy deleted the codex/fix-touch-interaction-for-shapes-and-blocks branch April 10, 2026 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant