@devries-cameron20 / t3code Mirror · read-only / commits / 219afe344c
Fork 0

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): keep long PR badge lists within the viewport (#18941)

Co-authored-by: Julius Marminge <julius0216@outlook.com>

Kevin Bravo committed Oct 20, 2026 at 00:11 UTC 219afe344cb1b23a4eb76f8d22a25579594fd086
2 files changed +77 -5
apps/web/src/components/ThreadStatusIndicators.subscriptions.browser.test.tsx
+75 -3
@@ -1,7 +1,16 @@
1 -import { ProjectId, ThreadId, type VcsStatusResult } from "@t3tools/contracts";
2 -import { act } from "react";
1 +import {
2 + ProjectId,
3 + ThreadId,
4 + type ThreadPullRequestLink,
5 + type VcsStatusResult,
6 +} from "@t3tools/contracts";
7 +import { act, type MouseEvent } from "react";
8 import { createRoot } from "react-dom/client";
9 import { afterEach, expect, it, vi } from "vite-plus/test";
10 +import { page, userEvent } from "vite-plus/test/browser";
11 +
12 +import "../index.css";
13 +import { Button } from "./ui/button";
14
15 import { AppAtomRegistryProvider } from "../rpc/atomRegistry";
16 import { makeThreadFixture } from "../test-fixtures";
@@ -75,7 +84,7 @@ vi.mock(import("../state/pullRequests"), async (importOriginal) => {
84 summaries(input.number)) as never,
85 };
86 });
78 -import { ThreadRowLeadingStatus } from "./ThreadStatusIndicators";
87 +import { ThreadPullRequestBadgeControl, ThreadRowLeadingStatus } from "./ThreadStatusIndicators";
88
89 afterEach(() => {
90 vi.unstubAllGlobals();
@@ -174,3 +183,66 @@ it("leases only visible palette results while retaining observed and cached PR b
183 container.remove();
184 }
185 });
186 +
187 +it("keeps a long PR hover list in the viewport and lets the last row be selected", async () => {
188 + vi.stubGlobal("IS_REACT_ACT_ENVIRONMENT", true);
189 + const previousViewport = { width: window.innerWidth, height: window.innerHeight };
190 + await page.viewport(800, 480);
191 + const pullRequests = Array.from({ length: 40 }, (_, index): ThreadPullRequestLink => ({
192 + host: "github.com",
193 + repository: "example/repo",
194 + number: index + 1,
195 + url: `https://github.com/example/repo/pull/${index + 1}`,
196 + source: "manual",
197 + linkedAt: "2026-01-01T00:00:00Z",
198 + snapshot: null,
199 + stack: null,
200 + }));
201 + const onOpenPullRequest = vi.fn((event: MouseEvent<HTMLElement>) => event.preventDefault());
202 + const container = document.createElement("div");
203 + document.body.append(container);
204 + const root = createRoot(container);
205 + try {
206 + await act(async () =>
207 + root.render(
208 + <div style={{ position: "fixed", top: 220, left: 300 }}>
209 + <ThreadPullRequestBadgeControl
210 + render={<Button size="xs" />}
211 + badge={{ kind: "pull-request", others: 39, state: "open" }}
212 + pullRequests={pullRequests}
213 + number={1}
214 + url={pullRequests[0]!.url}
215 + status={null}
216 + onOpenList={() => {}}
217 + onOpenPullRequest={onOpenPullRequest}
218 + />
219 + </div>,
220 + ),
221 + );
222 + await act(() => userEvent.hover(container.querySelector("button")!));
223 + const popup = () => document.querySelector<HTMLElement>('[data-slot="tooltip-popup"]')!;
224 + await expect.poll(() => popup()?.querySelectorAll("a").length).toBe(40);
225 + await expect.poll(() => popup().getBoundingClientRect().top).toBeGreaterThanOrEqual(0);
226 + await expect
227 + .poll(() => popup().getBoundingClientRect().bottom)
228 + .toBeLessThanOrEqual(window.innerHeight);
229 +
230 + const lastRow = popup().querySelector<HTMLAnchorElement>("li:last-child a")!;
231 + expect(lastRow.getBoundingClientRect().top).toBeGreaterThan(
232 + popup().getBoundingClientRect().bottom,
233 + );
234 + await act(() => userEvent.wheel(popup(), { delta: { y: 10_000 } }));
235 + await expect
236 + .poll(() => lastRow.getBoundingClientRect().bottom)
237 + .toBeLessThanOrEqual(popup().getBoundingClientRect().bottom);
238 + expect(lastRow.getBoundingClientRect().top).toBeGreaterThanOrEqual(
239 + popup().getBoundingClientRect().top,
240 + );
241 + await act(() => userEvent.click(lastRow));
242 + expect(onOpenPullRequest).toHaveBeenCalledExactlyOnceWith(expect.anything(), lastRow.href);
243 + } finally {
244 + await act(async () => root.unmount());
245 + container.remove();
246 + await page.viewport(previousViewport.width, previousViewport.height);
247 + }
248 +});
apps/web/src/components/ThreadStatusIndicators.tsx
+2 -2
@@ -298,7 +298,7 @@ function PullRequestBadge({
298 variant="glass"
299 className="pointer-events-auto w-80 max-w-[calc(100vw-2rem)] text-left whitespace-normal"
300 >
301 - <div className="-mx-1">
301 + <div className="-mx-1 max-h-[calc(var(--available-height)-0.5rem-2px)] overflow-y-auto overscroll-contain">
302 {visibleThreadPullRequests(pullRequests).length > 0 ? (
303 <ThreadPullRequestsMiniList
304 pullRequests={pullRequests}
@@ -398,7 +398,7 @@ function ThreadPullRequestMiniListItem({
398 href={url}
399 target="_blank"
400 rel="noopener noreferrer"
401 - className="flex min-w-0 items-center gap-2 rounded-sm px-1 py-1 hover:bg-accent focus-visible:bg-accent focus-visible:outline-2 focus-visible:outline-ring"
401 + className="flex min-w-0 items-center gap-2 rounded-sm px-1 py-1 hover:bg-accent focus-visible:bg-accent focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring"
402 onPointerDown={(event) => event.stopPropagation()}
403 onClick={(event) => onOpenPullRequest(event, url)}
404 >