Skip to content

🐛 Fix sidebar block drag on Android touch devices - #2569

Open
anishshetty24 wants to merge 1 commit into
baptisteArno:mainfrom
anishshetty24:fix/sidebar-drag-android-touch-support
Open

🐛 Fix sidebar block drag on Android touch devices#2569
anishshetty24 wants to merge 1 commit into
baptisteArno:mainfrom
anishshetty24:fix/sidebar-drag-android-touch-support

Conversation

@anishshetty24

Copy link
Copy Markdown

Problem

Fixes #2565
On Android tablets and iPads (touch-only devices), dragging new blocks from the left sidebar into the canvas never worked. The drag operation would never start.

Existing blocks on the canvas could be moved with touch (already used pointer events), but initiating a new block drag from the sidebar failed silently.

Root Cause

The sidebar drag lifecycle was built entirely on Mouse Events:

Before - only works with mouse:
onMouseDown to start drag
mousemove to track position
mouseup to end drag

Android Chrome does not fire mousedown/mousemove/mouseup for touch interactions - it fires Touch Events instead. So handleMouseDown was never called and the drag never started.

Fix

Migrate the sidebar drag system from Mouse Events to Pointer Events, which fire for mouse, touch, and stylus input uniformly - exactly what is already used in other parts of the builder (canvas blocks, endpoints, selection menu).

After - works with mouse + touch + stylus:
onPointerDown to start drag
pointermove to track position
pointerup to end drag

Files Changed

  • BlocksSideBar.tsx: mousemove/mouseup -> pointermove/pointerup; handlers accept PointerEvent
    • BlockCardLayout.tsx: onMouseDown -> onPointerDown on button
    • EventCardLayout.tsx: onMouseDown -> onPointerDown on button
    • BlockCard.tsx: Prop type updated to onPointerDown
    • EventCard.tsx: Prop type updated to onPointerDown
    • ForgedBlockCard.tsx: Prop type updated to onPointerDown

Testing

To test in Chrome DevTools:

  1. Open the builder.
  2. Press F12 -> Click the device toolbar icon (or Ctrl+Shift+M).
  3. Select Samsung Galaxy Tab S4 or any Android device.
  4. Try dragging a block from the sidebar -> it should now work.
  5. Switch back to desktop mode -> drag still works.

Migrate sidebar drag initialization from mouse events to pointer events
so that dragging new blocks from the sidebar works on Android tablets
and iPads (touch-only devices).

Previously, the drag lifecycle used:
- onMouseDown to start drag
- mousemove to track position
- mouseup to end drag

Android Chrome does not fire mouse events for touch interactions, so
the drag never started when using touch input.

The fix replaces all mouse event handlers with pointer events, which
fire for mouse, touch, and stylus input uniformly:
- onPointerDown to start drag
- pointermove to track position
- pointerup to end drag

This is consistent with how other parts of the builder (canvas blocks,
endpoints, selection menu) already handle touch input.

Files changed:
- BlocksSideBar.tsx: mousemove/mouseup → pointermove/pointerup global
  listeners; initBlockDragging/initEventDragging accept PointerEvent
- BlockCardLayout.tsx: onMouseDown → onPointerDown on button element
- EventCardLayout.tsx: onMouseDown → onPointerDown on button element
- BlockCard.tsx: prop type updated to onPointerDown
- EventCard.tsx: prop type updated to onPointerDown
- ForgedBlockCard.tsx: prop type updated to onPointerDown

Fixes: baptisteArno#2565
@vercel

vercel Bot commented Jul 24, 2026

Copy link
Copy Markdown

@anishshetty24 is attempting to deploy a commit to the Typebot Team on Vercel.

A member of the Team first needs to authorize it.

@vercel
vercel Bot temporarily deployed to Preview – viewer-v2 July 24, 2026 11:29 Inactive
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.

Builder: Dragging new blocks from sidebar doesn't work on Android touch devices

1 participant