fix(web): keep chat transcript pinned in WebKit (#3135)

This commit is contained in:
Carlos Florêncio
2026-08-29 07:28:10 +00:00
committed by GitHub
parent d1dbb6b8ea
commit bc25df33ff
5 changed files with 233 additions and 8 deletions
@@ -25,7 +25,8 @@ import { createDebugLogger, isDebug } from "@/lib/debug/log";
const paginationDebug = createDebugLogger("messages:pagination");
const NATIVE_BOTTOM_SCROLL_TOP = Number.MAX_SAFE_INTEGER;
// INT32_MAX: WebKit resolves Number.MAX_SAFE_INTEGER to 0 (not bottom).
const NATIVE_BOTTOM_SCROLL_TOP = 2_147_483_647;
/** Writes a clamped maximum so the browser resolves the native bottom without
* forcing a synchronous scrollHeight layout read. */
@@ -407,7 +407,7 @@ describe("useScrollToDividerOrBottom — anchored-bar offset", () => {
expect(scrollContainer.scrollTop).toBe(123);
});
it("pins an appended message without reading content size", () => {
it("uses a WebKit-safe maximum offset for pinned appends", () => {
const { rerender } = render(
<AutoScrollHarness isWorking={false} hasUnreadDivider={false} messages={TEST_MESSAGES} />,
);
@@ -442,7 +442,7 @@ describe("useScrollToDividerOrBottom — anchored-bar offset", () => {
);
}).not.toThrow();
expect(writes).toBe(1);
expect(scrollTop).toBe(Number.MAX_SAFE_INTEGER);
expect(scrollTop).toBe(2_147_483_647);
});
it("restores the disabled offset after a transient layout clamp", () => {