Fix web chat stickiness at non-default zoom (#2368)

Treat subpixel browser scroll rounding as the visual bottom while preserving material overscroll protection.
This commit is contained in:
Mohamed Boudra
2026-07-23 21:08:12 +02:00
committed by GitHub
parent 8a8f2baf80
commit b73592ccac
2 changed files with 86 additions and 1 deletions
@@ -22,6 +22,7 @@ type ScrollBehaviorLike = "auto" | "smooth";
const WEB_BOTTOM_SETTLE_TIMEOUT_MS = 200;
const USER_SCROLL_DELTA_EPSILON = 1;
const BOTTOM_OVERSCROLL_TOLERANCE_PX = 2;
const AUTO_SCROLL_BOTTOM_THRESHOLD_PX = 64;
const AUTO_SCROLL_RESUME_THRESHOLD_PX = 1;
const HISTORY_START_THRESHOLD_PX = 96;
@@ -88,7 +89,8 @@ function getScrollContainerDistanceFromBottom(
function isScrollContainerOverscrolledPastBottom(
scrollContainer: Pick<HTMLElement, "scrollTop" | "clientHeight" | "scrollHeight">,
): boolean {
return getScrollContainerDistanceFromBottom(scrollContainer) < 0;
// Browser zoom can leave scrollTop fractional while the height metrics remain integer-valued.
return getScrollContainerDistanceFromBottom(scrollContainer) < -BOTTOM_OVERSCROLL_TOLERANCE_PX;
}
function WebStreamViewport(props: StreamRenderInput & { isMobileBreakpoint: boolean }) {