From 0cc8f9070867174a8750dd68d968fa2d6de256aa Mon Sep 17 00:00:00 2001 From: l0ng-ai Date: Sun, 22 Nov 2026 20:47:43 +0800 Subject: [PATCH] fix(vcs): keep long Git Log filters compact (#5201) Long Git Log filter values now end in an ellipsis, with the full value available on hover. A tighter width in compact commit panes keeps the active filter and its clear button visible at more window sizes. --- e2e/gitLogToolbarMenus.spec.ts | 44 ++++++++++++++++++++++++++++++ src/features/vcs/GitLog.module.css | 11 +++++++- src/features/vcs/log/FilterBar.tsx | 8 +++++- 3 files changed, 61 insertions(+), 2 deletions(-) diff --git a/e2e/gitLogToolbarMenus.spec.ts b/e2e/gitLogToolbarMenus.spec.ts index 86d7f1a68..f8aee3d0f 100644 --- a/e2e/gitLogToolbarMenus.spec.ts +++ b/e2e/gitLogToolbarMenus.spec.ts @@ -225,6 +225,50 @@ test("Git Log keeps filters and actions inside the commit pane at the minimum wi await expect(page.getByRole("menuitem", { name: "Paths" })).toBeVisible(); }); +test("long Git Log filter values shorten inside their buttons", async ({ workbench: page }) => { + const branchName = "feature/quarterly-settlement-and-backoffice-invoice-reconciliation"; + await page.setViewportSize({ width: 1120, height: 720 }); + await page.evaluate(async (branch) => { + const logModule = "/src/features/vcs/logStore.ts"; + const optionsModule = "/src/features/vcs/logOptions.ts"; + const { setLogBranches } = await import(/* @vite-ignore */ logModule); + const { setLogOptions } = await import(/* @vite-ignore */ optionsModule); + setLogOptions({ showBranches: false, showDetails: false }); + setLogBranches([branch]); + }, branchName); + + const toolbar = page.getByRole("toolbar", { name: "Log filters" }); + const branch = toolbar.getByRole("button", { name: `Branch: ${branchName}`, exact: true }); + const value = branch.getByText(branchName, { exact: true }); + const clear = toolbar.getByRole("button", { name: "Clear Branch filter", exact: true }); + for (const width of [1120, 620]) { + await page.setViewportSize({ width, height: 720 }); + await expect(branch).toBeVisible(); + await expect(value).toHaveCSS("text-overflow", "ellipsis"); + expect( + await value.evaluate((label) => { + const bounds = label.getBoundingClientRect(); + const button = label.closest("button")!.getBoundingClientRect(); + return label.scrollWidth > label.clientWidth && bounds.width > 0 && bounds.right <= button.right; + }), + ).toBe(true); + await expect(branch).toHaveAttribute("title", branchName); + await clear.click({ trial: true }); + } + + await page.setViewportSize({ width: 400, height: 560 }); + // The overflow is measured after the resize: open the menu once the filter has moved into it. + await expect(branch).toBeHidden(); + await toolbar.getByRole("button", { name: "More Filters" }).click(); + await expect(page.getByRole("menuitem", { name: `Branch: ${branchName}`, exact: true })).toBeVisible(); + await page.keyboard.press("Escape"); + + await page.setViewportSize({ width: 620, height: 720 }); + await clear.click(); + await expect(toolbar.getByRole("button", { name: "Branch", exact: true })).toBeVisible(); + await expect(clear).toBeHidden(); +}); + test("Git Log puts affected changes on the changed-files toolbar and groups preview options", async ({ workbench: page, }) => { diff --git a/src/features/vcs/GitLog.module.css b/src/features/vcs/GitLog.module.css index 9c8e59f5e..ec60fce72 100644 --- a/src/features/vcs/GitLog.module.css +++ b/src/features/vcs/GitLog.module.css @@ -162,15 +162,24 @@ white-space: nowrap; max-width: 220px; overflow: hidden; - text-overflow: ellipsis; } .filterValue { + min-width: 0; + max-width: 16ch; + overflow: hidden; + text-overflow: ellipsis; color: var(--fg-strong); } +@container git-log (max-width: 600px) { + .filterValue { + max-width: 10ch; + } +} .filterChevron { color: var(--fg-icon); } .filterClear { + flex: none; height: 100%; display: inline-flex; align-items: center; diff --git a/src/features/vcs/log/FilterBar.tsx b/src/features/vcs/log/FilterBar.tsx index 76f7397ee..0cd3e477d 100644 --- a/src/features/vcs/log/FilterBar.tsx +++ b/src/features/vcs/log/FilterBar.tsx @@ -56,7 +56,13 @@ function FilterButton({ label, value, onOpen, onClear, hidden }: LogFilter & { h className={clsx(styles.filterButton, value && styles.filterActive, hidden && styles.filterHidden)} inert={hidden} > -