fix(chat): align scrollbar/keyboard detach with wheel/touch re-engage threshold#5094
fix(chat): align scrollbar/keyboard detach with wheel/touch re-engage threshold#5094waleedlatif1 wants to merge 1 commit into
Conversation
… threshold The onScroll detach branch set only stickyRef.current = false, leaving userDetachedRef false, so a scrollbar-drag or keyboard detach kept the lenient 30px (STICK_THRESHOLD) re-engage threshold instead of the strict 5px (REATTACH_THRESHOLD) used after wheel/touch. A programmatic virtualizer re-pin landing within 30px could then snap autoscroll back on right after the user deliberately scrolled away. Reuse the detach() helper so all detach paths set userDetachedRef consistently.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryLow Risk Overview The The branch now calls the shared Reviewed by Cursor Bugbot for commit caf77ad. Configure here. |
Greptile SummaryThis is a one-line follow-up bug fix to PR #5093. The
Confidence Score: 5/5Safe to merge — the change is a one-line correction to a clearly identified inconsistency between detach paths. The only code touched is the else-if branch inside onScroll that was the sole remaining caller not using the shared detach() helper. All four detach paths now set both refs identically. The fix introduces no new logic and cannot regress wheel or touch detaches, which already went through detach(). The re-engagement condition is unchanged; only the threshold used after a scrollbar/keyboard detach tightens from 30px to 5px, which is the intended behavior documented throughout the hook. No files require special attention. Important Files Changed
Reviews (1): Last reviewed commit: "fix(chat): align scrollbar/keyboard deta..." | Re-trigger Greptile |
Summary
onScrolldetach branch set onlystickyRef.current = false, leavinguserDetachedReffalse — so a scrollbar-drag or keyboard detach kept the lenient 30px (STICK_THRESHOLD) re-engage threshold instead of the strict 5px (REATTACH_THRESHOLD) used after wheel/touch.react-virtualre-pin landing within 30px of the bottom could snap autoscroll back on right after the user deliberately scrolled away — the same spurious re-engagement fix(chat): keep autoscroll pinned when the virtualizer re-scrolls during streaming #5093 fixes in the other direction.detach()helper in that branch so every detach path setsuserDetachedRefconsistently. One line.Type of Change
Testing
Verified in headless Chromium against the exact
onScrolllogic: after a scrollbar-drag detach, a re-pin landing 20px from the bottom (within 30px, outside 5px) no longer re-engages (it did before this change); genuine return to within 5px still re-engages.tscclean, biome clean.Checklist