Skip to content

fix(ty-chrome): make annotation drags work in mobile/touch responsive mode#607

Open
bborn wants to merge 1 commit into
mainfrom
task/4430-fix-taskyou-extension-mobile-responsive
Open

fix(ty-chrome): make annotation drags work in mobile/touch responsive mode#607
bborn wants to merge 1 commit into
mainfrom
task/4430-fix-taskyou-extension-mobile-responsive

Conversation

@bborn

@bborn bborn commented Jun 19, 2026

Copy link
Copy Markdown
Owner

Problem

The ty-chrome annotation extension breaks when Chrome is in mobile responsive simulation (DevTools device toolbar with touch emulation). The on-page overlay drove all of its interactions off mouse events:

  • Select hover highlight — mouseover
  • Box drawing — mousedown / mousemove / mouseup
  • Region move/resizemousedown + document mousemove/mouseup

Under touch emulation Chrome dispatches pointer/touch events, not mouse events, and (without touch-action) consumes the drag gesture to scroll/zoom the page. So drawing a box, moving/resizing a region, and the hover highlight all stopped working.

Fix

  • Convert every drag interaction from mouse events to Pointer Events (pointerdown/pointermove/pointerup/pointerover). Pointer events unify mouse, touch, and pen, and fire correctly in both normal and touch-emulation modes.
  • Add touch-action: none to the draggable surfaces (.boxlayer, .region, .marker) so the browser stops hijacking the gesture for scroll/zoom.
  • Use setPointerCapture on the box layer and region box so a fast drag stays bound to its surface even when the pointer leaves it.
  • Add touch-action: manipulation to toolbar/popover buttons to drop the double-tap-zoom tap delay.

Tap-to-select and marker taps already worked (Chrome synthesizes click from a tap); this restores the drag-based interactions, which were the broken part.

Files changed

  • extensions/ty-chrome/content.js — mouse → pointer events + touch-action on draggable/clickable surfaces
  • extensions/ty-chrome/README.md — note that the drags work under DevTools mobile/responsive mode

Testing

The extension is vanilla JS with no automated test harness (only a manual Playwright demo in demo/). Verified node --check passes. Manual verification: open a localhost task page, toggle DevTools device toolbar, and confirm Box draw + region move/resize now work.

🤖 Generated with Claude Code

The annotation overlay drove Select hover, Box drawing, and region
move/resize off mouse events (mousedown/mousemove/mouseup/mouseover).
Under Chrome DevTools' mobile responsive (touch-emulation) mode those
events don't fire — the browser dispatches pointer/touch events instead
and steals the gesture for scrolling/zooming — so the annotation UX broke.

Switch all drag interactions to Pointer Events, which unify mouse, touch,
and pen, and add `touch-action: none` to the draggable surfaces so the
browser no longer hijacks the gesture. Pointer capture keeps each drag
bound to its surface even when the pointer leaves it. Buttons get
`touch-action: manipulation` to drop the double-tap-zoom delay.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

1 participant