From e3a4ea8f706deb46e35d3df9f15c790fb9381a38 Mon Sep 17 00:00:00 2001 From: Thomas Petersen Date: Tue, 23 Jun 2026 15:16:27 -0400 Subject: [PATCH] Fix collapsed home header chrome overlap Co-authored-by: Thomas Petersen Signed-off-by: Thomas Petersen --- desktop/playwright.config.ts | 1 + .../src/features/home/ui/InboxListPane.tsx | 11 +++++- ...e-collapsed-top-chrome-screenshots.spec.ts | 36 +++++++++++++++++++ 3 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 desktop/tests/e2e/home-collapsed-top-chrome-screenshots.spec.ts diff --git a/desktop/playwright.config.ts b/desktop/playwright.config.ts index 7f7ccce4fd..5c431eba76 100644 --- a/desktop/playwright.config.ts +++ b/desktop/playwright.config.ts @@ -47,6 +47,7 @@ export default defineConfig({ "**/relay-connectivity-screenshots.spec.ts", "**/unread-pill-screenshots.spec.ts", "**/sidebar-more-unread-overlap.spec.ts", + "**/home-collapsed-top-chrome-screenshots.spec.ts", "**/thread-unread-screenshots.spec.ts", "**/animated-avatar-screenshots.spec.ts", "**/reminders-screenshots.spec.ts", diff --git a/desktop/src/features/home/ui/InboxListPane.tsx b/desktop/src/features/home/ui/InboxListPane.tsx index 697045d845..5f2fe39936 100644 --- a/desktop/src/features/home/ui/InboxListPane.tsx +++ b/desktop/src/features/home/ui/InboxListPane.tsx @@ -16,6 +16,7 @@ import { import { RemindersPanel } from "@/features/reminders/ui/RemindersPanel"; import { TopChromeInsetHeader } from "@/shared/layout/TopChromeInsetHeader"; import { cn } from "@/shared/lib/cn"; +import { useOptionalSidebar } from "@/shared/ui/sidebar"; import { ContextMenu, ContextMenuContent, @@ -131,6 +132,9 @@ export function InboxListPane({ reminderPubkey, unreadOnly, }: InboxListPaneProps) { + const sidebar = useOptionalSidebar(); + const clearCollapsedTopChromeControls = + sidebar?.state === "collapsed" && !sidebar.isMobile; const activeFilter = FILTER_OPTIONS.find((option) => option.value === filter); const isReminders = filter === "reminders"; const scrollRef = React.useRef(null); @@ -325,7 +329,12 @@ export function InboxListPane({ )} > -
+
diff --git a/desktop/tests/e2e/home-collapsed-top-chrome-screenshots.spec.ts b/desktop/tests/e2e/home-collapsed-top-chrome-screenshots.spec.ts new file mode 100644 index 0000000000..3ccb24fb1e --- /dev/null +++ b/desktop/tests/e2e/home-collapsed-top-chrome-screenshots.spec.ts @@ -0,0 +1,36 @@ +import { expect, test } from "@playwright/test"; + +import { waitForAnimations } from "../helpers/animations"; +import { installMockBridge } from "../helpers/bridge"; + +const SHOTS = "test-results/home-collapsed-top-chrome"; + +test.describe("home inbox header collapsed-sidebar chrome clearance", () => { + test.use({ viewport: { width: 1280, height: 720 } }); + + test("inbox options clear the macOS traffic-light region when sidebar is collapsed", async ({ + page, + }) => { + await installMockBridge(page); + await page.goto("/"); + await expect(page.getByTestId("home-inbox-list")).toBeVisible(); + + await page.locator('[data-sidebar="trigger"]').click(); + + const inboxOptions = page.getByTestId("inbox-options-trigger"); + await expect(inboxOptions).toBeVisible(); + await expect + .poll(async () => + inboxOptions.evaluate((element) => + Math.round(element.getBoundingClientRect().left), + ), + ) + .toBeGreaterThanOrEqual(168); + + await waitForAnimations(page); + await page.screenshot({ + path: `${SHOTS}/01-collapsed-inbox-header-clears-traffic-lights.png`, + clip: { x: 0, y: 0, width: 420, height: 120 }, + }); + }); +});