Skip to content

Conversation

@daniel-graham-amplitude
Copy link
Collaborator

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

Summary

Cancel a rage click if there is a text highlight event that happens after a click.

If a user clicks 1 or more times, and then text is highlighted, that suggests that the user's clicks caused the text to be highlighted

Here's a demonstration to show if you highlight text in an input, the first 3 clicks cause the text to be highlighted, which cancels out the rage click. You thus need at least 7 clicks for it to be a rage click (4 clicks after the text is done being highlighted).

Screen Recording 2026-01-02 at 5.41.11 PM

Checklist

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

Note

Prevents false-positive rage clicks when users highlight text.

  • Adds SelectionObservable to observables (enum, types) and implements a selectionchange-based observable in frustration-plugin
  • Updates track-rage-click to subscribe to selectionObservable and reset the click window on selection change
  • Extends tests to cover selection-change behavior and ensure correct rage click detection

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

@daniel-graham-amplitude daniel-graham-amplitude marked this pull request as draft January 3, 2026 00:27
@macroscopeapp
Copy link
Contributor

macroscopeapp bot commented Jan 3, 2026

Reset rage-click aggregation on text selection changes and add ObservablesEnum.SelectionObservable used by trackRageClicks in autocapture/track-rage-click.ts

Add a selectionObservable that emits on selectionchange, expose it via ObservablesEnum.SelectionObservable, and reset the click window in trackRageClicks on selection changes; include tests covering selection between clicks in track-rage-click.test.ts.

🖇️ Linked Issues

Addresses AMP-146044 by preventing rage-clicks from spanning text selections as part of the AMP-146043 epic.

📍Where to Start

Start with the createObservables implementation wiring selectionObservable in frustration-plugin.ts, then review its consumption in trackRageClicks in autocapture/track-rage-click.ts.


📊 Macroscope summarized 2e728e5. 3 files reviewed, 2 issues evaluated, 0 issues filtered, 1 comment posted. View details

@daniel-graham-amplitude daniel-graham-amplitude changed the title Amp 146044 fix highlightable text rage clicks fix(plugin-autocapture-browser): do not trigger rage click when text being highlighted Jan 3, 2026
Comment on lines +201 to +205
unsubscribe: () => {
rageClickSubscription.unsubscribe();
/* istanbul ignore next */
selectionSubscription?.unsubscribe();
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Pending rage‑click timeout isn’t cleared, so it can fire after teardown or a window reset and emit unexpectedly. Suggest always cancel and null any pending rageClick timer during teardown and whenever the click window is reset.

Suggested change
unsubscribe: () => {
rageClickSubscription.unsubscribe();
/* istanbul ignore next */
selectionSubscription?.unsubscribe();
},
unsubscribe: () => {
if (pendingRageClick) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
clearTimeout(pendingRageClick.timerId);
pendingRageClick = null;
}
rageClickSubscription.unsubscribe();
/* istanbul ignore next */
selectionSubscription?.unsubscribe();
},

🚀 Want me to fix this? Reply ex: "fix it for me".

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.

2 participants