Skip to content

Conversation

@daniel-graham-amplitude
Copy link
Collaborator

@daniel-graham-amplitude daniel-graham-amplitude commented Jan 1, 2026

Summary

It's been observed that when a user scrolls quickly on mobile web, it will often trigger a false "Rage Click". This is because a scroll event involves touching the same part of the screen several times.

What this fix does is changes the bounding box requirements for a rage click

  • Previously: the bounding box was defined as a space in the viewport (clientX, clientY)
  • Now: the bounding box is defined as a space in the window (pageX, pageY)

This prevents scrolling events from being registered, because each touch will be in a different part of the window, because the page is scrolling

Extras

  • I noticed there were some imports like import * from 'src/<modulePath>'. Refactored this to use relative paths instead, it was making it so that I couldn't do npx jest <filepath>

Checklist

  • Does your PR title have the correct title format?
  • Does your PR have a breaking change?:

Note

Rage click detection

  • Compute bounding boxes with pageX/pageY instead of clientX/clientY and emit click coordinates using window-based values in track-rage-click.ts
  • Update rage click window/out-of-bounds handling accordingly; preserve thresholds/time-window logic
  • Refresh unit tests to assert pageX/pageY behavior and timing; add type annotation in track-click.ts

Refactors/housekeeping

  • Replace src/... imports with relative paths across autocapture/pageActions modules
  • Add test-server/scroll-test.html for manual scroll testing (enables frustration interactions/rage clicks)

Written by Cursor Bugbot for commit 07b1239. This will update automatically on new commits. Configure here.

@daniel-graham-amplitude daniel-graham-amplitude marked this pull request as draft January 1, 2026 01:24
@macroscopeapp
Copy link
Contributor

macroscopeapp bot commented Jan 1, 2026

Fix rage click detection in plugin-autocapture-browser to use page coordinates and apply window-level bounds for frustrationInteractions.rageClicks

Switch rage click region calculations and emitted coordinates from MouseEvent.clientX/clientY to MouseEvent.pageX/pageY, update related tests, and repoint internal imports in autocapture and pageActions modules. Core logic change resides in [track-rage-click.ts] utilities; a manual test page is added for scroll scenarios.

🖇️ Linked Issues

Addresses AMP-146045 under the AMP-146043 epic by correcting rage click detection to exclude viewport-based misclassification.

📍Where to Start

Start with the rage click logic in packages/plugin-autocapture-browser/src/autocapture/track-rage-click.ts, focusing on addCoordinates and getRageClickAnalyticsEvent.


Macroscope summarized 87c90f1.

@daniel-graham-amplitude daniel-graham-amplitude marked this pull request as ready for review January 2, 2026 17:22
@macroscopeapp
Copy link
Contributor

macroscopeapp bot commented Jan 2, 2026

Apply page-based coordinates to rage click detection in packages/plugin-autocapture-browser/src/autocapture/track-rage-click.ts to address mobile scrolling touch classification

Switch rage click region and payload coordinates from MouseEvent.clientX/clientY to MouseEvent.pageX/pageY and update tests accordingly; adjust imports across autocapture modules.

🖇️ Linked Issues

Addresses AMP-146045 under the AMP-146043 epic by using page coordinates for rage clicks, impacting touch/scroll classification.

📍Where to Start

Start with addCoordinates and getRageClickAnalyticsEvent in packages/plugin-autocapture-browser/src/autocapture/track-rage-click.ts.


Macroscope summarized 07b1239.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes false rage click detection on mobile web by changing the coordinate system from viewport-based (clientX/clientY) to window-based (pageX/pageY). This prevents scrolling gestures from being incorrectly flagged as rage clicks, since each touch during a scroll will be at different window coordinates even if they appear in the same viewport position. Additionally, the PR refactors imports from absolute src/* paths to relative paths.

  • Changed rage click bounding box calculations to use window coordinates (pageX/pageY)
  • Updated all rage click tests to use pageX/pageY coordinates
  • Refactored imports from src/* to relative paths for better module resolution

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
test-server/scroll-test.html Adds manual testing page with 15,000px height to verify scroll gesture vs rage click detection
packages/plugin-autocapture-browser/test/autocapture-plugin/track-rage-click.test.ts Updates all test cases to use pageX/pageY instead of clientX/clientY; adds edge case test for out-of-bounds detection with fixed viewport coordinates
packages/plugin-autocapture-browser/src/pageActions/triggers.ts Refactors import from src/helpers to relative path ../helpers
packages/plugin-autocapture-browser/src/pageActions/matchEventToFilter.ts Refactors import from src/helpers to relative path ../helpers
packages/plugin-autocapture-browser/src/autocapture/track-rage-click.ts Changes coordinate system from viewport (clientX/clientY) to window (pageX/pageY) in bounding box calculations and tracked event data; refactors import path
packages/plugin-autocapture-browser/src/autocapture/track-dead-click.ts Refactors import from src/frustration-plugin to relative path ../frustration-plugin
packages/plugin-autocapture-browser/src/autocapture/track-click.ts Refactors imports to relative paths and adds explicit type annotation for click event subscription
packages/plugin-autocapture-browser/src/autocapture/track-change.ts Refactors imports to relative paths and consolidates import statements
packages/plugin-autocapture-browser/src/autocapture/track-action-click.ts Refactors import from src/autocapture-plugin to relative path ../autocapture-plugin

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…cript into AMP-146045-rage-click-fix-mobile-scroll-false-positive
@daniel-graham-amplitude daniel-graham-amplitude changed the title fix: apply rage clicks to window over viewport fix(plugin-autocapture-browser): apply rage clicks to window over viewport Jan 3, 2026
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