The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 22, 23:15 UTC
fix(web): pull request header no longer flickers when scrolled to the bottom (#15678)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Julius Marminge <julius0216@outlook.com>
Rakshith Bhat committed
Oct 20, 2026 at 09:48 UTC
7f1ecf3463ec56696fea253c6f4a3db8ddd617df
2 files changed
+42
-6
apps/web/src/components/pullRequest/PullRequestDetailPanel.browser.test.tsx
+37
@@ -406,6 +406,43 @@ it("folds the title only for the active tab's own scroller", async () => {
406
await vi.waitFor(() => expect(titleFold()).toBe(true));
407
});
408
409
+it("stays collapsed at the bottom after native scroll clamping and reopens at the top", async () => {
410
+ await render();
411
+ const title = page.getByRole("heading", { level: 1, name: "Test pull request" });
412
+ await expect.element(title).toBeVisible();
413
+ const scroller = page.getByTestId("summary-scroller").element() as HTMLElement;
414
+ const content = scroller.lastElementChild as HTMLElement;
415
+ // Leave only a short scroll range so folding the header makes the browser clamp it.
416
+ content.style.height = `${scroller.clientHeight - 24}px`;
417
+ const expandedHeight = scroller.clientHeight;
418
+ const expandedBottom = scroller.scrollHeight - scroller.clientHeight;
419
+
420
+ await act(async () => {
421
+ const scrolled = new Promise<void>((resolve) =>
422
+ scroller.addEventListener("scroll", () => resolve(), { once: true }),
423
+ );
424
+ scroller.scrollTop = scroller.scrollHeight;
425
+ await scrolled;
426
+ });
427
+
428
+ await vi.waitFor(() => {
429
+ expect(title.element().closest("[inert]")).not.toBeNull();
430
+ expect(scroller.clientHeight).toBeGreaterThan(expandedHeight);
431
+ expect(scroller.scrollTop).toBeGreaterThan(0);
432
+ expect(scroller.scrollTop).toBeLessThan(expandedBottom);
433
+ expect(scroller.scrollTop).toBe(scroller.scrollHeight - scroller.clientHeight);
434
+ });
435
+
436
+ await act(async () => {
437
+ const scrolled = new Promise<void>((resolve) =>
438
+ scroller.addEventListener("scroll", () => resolve(), { once: true }),
439
+ );
440
+ scroller.scrollTop = 0;
441
+ await scrolled;
442
+ });
443
+ await vi.waitFor(() => expect(title.element().closest("[inert]")).toBeNull());
444
+});
445
+
446
it("shows the current checkout recovery detail on the first failure and on retry", async () => {
447
const first = new GitManagerError({
448
cwd: "/workspace",
apps/web/src/components/pullRequest/PullRequestDetailPanel.tsx
+5
-6
@@ -697,10 +697,12 @@ export function PullRequestDetailPanel({
697
}));
698
const foldRef = useRef<HTMLDivElement | null>(null);
699
const condensedRowRef = useRef<HTMLDivElement | null>(null);
700
+ // Save the target before collapse: the browser may clamp scrollTop as the viewport grows,
701
+ // so applying a delta afterward would compensate twice.
702
const compensationRef = useRef<{
703
tab: DetailTab;
704
scroller: HTMLDivElement;
703
- delta: number;
705
+ target: number;
706
} | null>(null);
707
useLayoutEffect(() => {
708
const compensation = compensationRef.current;
@@ -712,10 +714,7 @@ export function PullRequestDetailPanel({
714
scrollerByTab.current[tab] !== compensation.scroller
715
)
716
return;
715
- compensation.scroller.scrollTop = Math.max(
716
- 0,
717
- compensation.scroller.scrollTop + compensation.delta,
718
- );
717
+ compensation.scroller.scrollTop = Math.max(0, compensation.target);
718
}, [condensed, tab]);
719
const lastSelectedMergeMethod = useUiStateStore((state) => state.pullRequestMergeMethod);
720
const setLastSelectedMergeMethod = useUiStateStore((state) => state.setPullRequestMergeMethod);
@@ -2771,7 +2770,7 @@ export function PullRequestDetailPanel({
2770
if (top < 4 && foldHeight > 0) next = false;
2771
} else if (foldHeight > 0 && top > foldHeight + 32) {
2772
const chromeDelta = foldHeight - (condensedRowRef.current?.scrollHeight ?? 0);
2774
- compensationRef.current = { tab, scroller, delta: -chromeDelta };
2773
+ compensationRef.current = { tab, scroller, target: top - chromeDelta };
2774
next = true;
2775
}
2776
if (next !== previous) setCondensedByTab({ ...condensedByTab, [tab]: next });