-
Notifications
You must be signed in to change notification settings - Fork 58
fix(plugin-autocapture-browser): do not trigger rage click when text being highlighted #1471
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: AMP-146045-rage-click-fix-mobile-scroll-false-positive
Are you sure you want to change the base?
Conversation
Reset rage-click aggregation on text selection changes and add
|
packages/plugin-autocapture-browser/src/autocapture/track-rage-click.ts
Outdated
Show resolved
Hide resolved
| unsubscribe: () => { | ||
| rageClickSubscription.unsubscribe(); | ||
| /* istanbul ignore next */ | ||
| selectionSubscription?.unsubscribe(); | ||
| }, |
There was a problem hiding this comment.
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.
| 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".
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
Note
Prevents false-positive rage clicks when users highlight text.
SelectionObservableto observables (enum, types) and implements aselectionchange-based observable infrustration-plugintrack-rage-clickto subscribe toselectionObservableand reset the click window on selection changeWritten by Cursor Bugbot for commit ce48dcd. This will update automatically on new commits. Configure here.