Skip to content

Drop touch gestures that gain a finger the chart never saw - #238

Merged
novykh merged 3 commits into
mainfrom
fix/dygraph-touch-count
Sep 29, 2026
Merged

novykh merged 3 commits into
mainfrom
fix/dygraph-touch-count

Conversation

@novykh

@novykh novykh commented Sep 28, 2026

Copy link
Copy Markdown
Member

Problem

Sentry NETDATA-INC-DNA (45 events in 24h, all on cloud-frontend 7.129.0 with charts 6.12.15): Cannot read properties of undefined (reading 'pageX') in dygraphs moveTouch (dygraph-interaction-model.js:525, initialTouches[1].pageX).

The #237 guard (generic.js) only checks that context.initialTouches exists. When the second finger lands outside the chart, its touchstart never reaches the canvas, so dygraphs records one touch, while later touchmove events list both fingers. The production stack confirms the guard shipped: the throwing call is the line right after if (!context.initialTouches) return.

Change

touchMove clears the stale gesture and ignores the event when it carries more touches than the gesture started with. Valid pans and two-finger pinches still delegate to dygraphs.

Tests

  • New: one-finger touchstart then a two-finger touchmove with no second touchstart. Before the fix it throws the production TypeError at dygraph-interaction-model.js:525:44 via generic.js:124.
  • Control: a two-finger pinch that started on the chart still delegates (passes before and after).
  • Full suite: 166 suites, 1688 tests passed.

Release

cloud-frontend needs a charts release with this change and an @netdata/charts bump before DNA stops. Browser check still pending: pan, pinch, adding a finger outside the chart, double tap, on iOS Safari and Android Chrome.

dygraphs records the touches of touchstart and, on a two-finger touchmove,
reads initialTouches[1]. When the second finger lands outside the chart its
touchstart never reaches the canvas, yet later touchmove events list both
fingers, so moveTouch read initialTouches[1].pageX of undefined. touchMove now
clears the stale gesture and ignores the event when it carries more touches than
the gesture started with.
kapantzak
kapantzak previously approved these changes Sep 29, 2026
@novykh
novykh merged commit d685951 into main Sep 29, 2026
2 checks passed
@novykh
novykh deleted the fix/dygraph-touch-count branch September 29, 2026 12:09
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.

3 participants