fix: thread pagination not loading when dragging the scrollbar

Merged
JE
3mo ago
+181-2

Proposed changes (including videos or screenshots)

Thread pagination was guarded until the user interacted with the message list. However, dragging the custom overlay scrollbar did not count as an interaction because the scrollbar is rendered outside the scrollable viewport.

This change listens for pointerdown on the viewport's parent, where events from the overlay scrollbar are received. The listener is removed during cleanup. This matches the existing room-history pagination behavior in #41098.

The test verifies that:

  • Scrolling before a recognized user interaction does not fetch another page.
  • Interacting with the overlay scrollbar and reaching the upper pagination threshold fetches the previous page.

Issue(s)

CORE-2512

Steps to test or reproduce

  1. Open a channel with a thread containing enough replies to have unloaded pages.
  2. Open the thread.
  3. Without using the mouse wheel, drag the overlay scrollbar to the top.
  4. Confirm that reaching the pagination threshold fetches the previous page.
  5. Confirm that wheel, touch, and keyboard scrolling continue to work as expected.

Further comments

Summary by CodeRabbit

  • Bug Fixes
    • Improved thread message scrolling behavior so older messages load only after intentional scrollbar interaction followed by scrolling.
    • Prevented unintended message fetches from scrolling alone.
  • Tests
    • Added coverage for scrollbar interaction and ensured previous-page requests occur exactly once.