fix(chat): suppress programmatic scroll while user is scrolling (#132) #216

Merged
hodlbod merged 1 commits from Khushvendra/flotilla:fix/scroll-jitter-132 into dev 2026-04-16 23:20:17 +00:00
Contributor

Closes #132.

Summary
Scrolling in reversed chat layouts could jitter and jump to extreme positions during mouse wheel and trackpad use. The core issue was programmatic scroll management running while the user was actively scrolling and while new event batches were re-rendering.

Root Cause

  • The elements-driven effect re-ran scroll management on event updates.
  • Feed updates during active scroll caused frequent DOM/layout changes.
  • There was no active-user-scroll guard to pause programmatic adjustments.

Changes made

  • Added an isUserScrolling state flag in both chat views.
  • Added a 150ms debounced clear using throttle-debounce to detect scroll end.
  • In onScroll, only user-initiated scrolls set isUserScrolling.
  • Guarded the elements effect so manageScrollPosition does not run while isUserScrolling is true.
  • Kept existing programmatic scroll behavior intact, including deep-link positioning via at and normal scroll-to-bottom/new-message actions.
  • No changes were made to feed loading logic in requests.

Validation

  • ESLint passed for both touched files.
  • Full repository typecheck currently fails due unrelated pre-existing errors in poll-related imports/types and capacitor share typing, not introduced by this PR.
Closes #132. **Summary** Scrolling in reversed chat layouts could jitter and jump to extreme positions during mouse wheel and trackpad use. The core issue was programmatic scroll management running while the user was actively scrolling and while new event batches were re-rendering. **Root Cause** - The elements-driven effect re-ran scroll management on event updates. - Feed updates during active scroll caused frequent DOM/layout changes. - There was no active-user-scroll guard to pause programmatic adjustments. **Changes made** - Added an `isUserScrolling` state flag in both chat views. - Added a 150ms debounced clear using throttle-debounce to detect scroll end. - In `onScroll`, only user-initiated scrolls set `isUserScrolling`. - Guarded the elements effect so `manageScrollPosition` does not run while `isUserScrolling` is true. - Kept existing programmatic scroll behavior intact, including deep-link positioning via at and normal scroll-to-bottom/new-message actions. - No changes were made to feed loading logic in requests. **Validation** - ESLint passed for both touched files. - Full repository typecheck currently fails due unrelated pre-existing errors in poll-related imports/types and capacitor share typing, not introduced by this PR.
Khushvendra added 1 commit 2026-04-16 23:17:45 +00:00
Owner

Nice, this is an elegant solution.

Nice, this is an elegant solution.
hodlbod merged commit 4a967de184 into dev 2026-04-16 23:20:17 +00:00
hodlbod deleted branch fix/scroll-jitter-132 2026-04-16 23:20:17 +00:00
Sign in to join this conversation.