diff --git a/webui/src/components/SidebarSelectionHighlight.tsx b/webui/src/components/SidebarSelectionHighlight.tsx index fb0b4dbea..6b89c34d2 100644 --- a/webui/src/components/SidebarSelectionHighlight.tsx +++ b/webui/src/components/SidebarSelectionHighlight.tsx @@ -62,19 +62,14 @@ export function SidebarSelectionHighlight({ const firstPosition = !positionedRef.current; if (firstPosition) highlight.style.transitionProperty = "none"; - // Align the paint origin and destination to layout pixels. A fractional - // origin rasterized before translation can leave seams beside row backgrounds. - const snap = Math.round; - const originLeft = snap(containerRect.left); - const originTop = snap(containerRect.top); - const targetLeft = snap(targetRect.left); - const targetTop = snap(targetRect.top); - highlight.style.left = `${originLeft - containerRect.left}px`; - highlight.style.top = `${originTop - containerRect.top}px`; - highlight.style.width = `${snap(targetRect.right) - targetLeft}px`; - highlight.style.height = `${snap(targetRect.bottom) - targetTop}px`; - highlight.style.transform = `translate3d(${targetLeft - originLeft}px, ${ - targetTop - originTop + // Preserve fractional layout coordinates so the highlight shares the + // target's edges, including where it meets an adjacent hover background. + highlight.style.left = "0px"; + highlight.style.top = "0px"; + highlight.style.width = `${targetRect.width}px`; + highlight.style.height = `${targetRect.height}px`; + highlight.style.transform = `translate3d(${targetRect.left - containerRect.left}px, ${ + targetRect.top - containerRect.top }px, 0)`; highlight.style.opacity = "1"; positionedRef.current = true; diff --git a/webui/src/components/thread/WorkspaceControls.tsx b/webui/src/components/thread/WorkspaceControls.tsx index 561c5a2b4..7b9bde031 100644 --- a/webui/src/components/thread/WorkspaceControls.tsx +++ b/webui/src/components/thread/WorkspaceControls.tsx @@ -154,16 +154,6 @@ function WorkspacePickerPath({ path }: { path: string }) { ); } -function WorkspaceSavedProjectLabel({ path }: { path: string }) { - const parts = workspacePathCompletionQuery(path); - return ( - - {projectNameFromPath(path)} - {parts?.query && {parts.path}} - - ); -} - export function WorkspaceProjectPicker({ isHero, disabled, scope, defaultScope, controls, error, onLoadProjects, onResolveProject, onFavoriteProject, onBrowseDirectories, layoutAnchor, onChange }: { layoutAnchor?: HTMLElement | null; isHero: boolean; @@ -645,11 +635,10 @@ export function WorkspaceProjectPicker({ isHero, disabled, scope, defaultScope, onPointerEnter={() => setHoveredLocation(project.path)} onPointerLeave={() => setHoveredLocation(null)}> {favoriteButton(project.path)} @@ -659,7 +648,7 @@ export function WorkspaceProjectPicker({ isHero, disabled, scope, defaultScope, ))} } -
+
{columns.map((column, columnIndex) => (!compact || columnIndex === currentColumnIndex) && - {option.kind === "directory" ? {option.name} : } {sameWorkspacePath(option.path, scope?.project_path ?? defaultScope.project_path) && } diff --git a/webui/src/tests/sidebar-selection-highlight.test.tsx b/webui/src/tests/sidebar-selection-highlight.test.tsx index fdcf19fb4..da3b60e9b 100644 --- a/webui/src/tests/sidebar-selection-highlight.test.tsx +++ b/webui/src/tests/sidebar-selection-highlight.test.tsx @@ -22,7 +22,7 @@ function Harness({ activeId, targetByRef }: { activeId: string | null; targetByR describe("sidebar selection highlight geometry", () => { it.each([true, false])("updates the animated width as its target resizes (target by ref: %s)", (targetByRef) => { - let width = 272; + let width = 272.25; let frameId = 0; const frames = new Map(); vi.spyOn(window, "requestAnimationFrame").mockImplementation((callback) => { @@ -47,14 +47,14 @@ describe("sidebar selection highlight geometry", () => { const container = this.dataset.testid === "highlight-container"; const second = this.textContent === "Second"; const inset = container ? 0 : second ? 24 : 8; - const x = 100 + inset; - const y = container ? 20 : second ? 100 : 60; + const x = 100.5 + inset; + const y = container ? 20.5 : second ? 100.5 : 60.5; const w = container ? width : width - inset - 8; return { x, y, left: x, top: y, right: x + w, bottom: y + 32, width: w, height: 32, toJSON() {} }; }); const { rerender } = render(); const highlight = screen.getByTestId("test-selection-highlight"); - expect(highlight).toHaveStyle({ width: "256px", height: "32px", transform: "translate3d(8px, 40px, 0)" }); + expect(highlight).toHaveStyle({ left: "0px", top: "0px", width: "256.25px", height: "32px", transform: "translate3d(8px, 40px, 0)" }); paint(); // After initial placement, every observer update changes the animation's @@ -65,7 +65,7 @@ describe("sidebar selection highlight geometry", () => { width = 420; act(() => resizes.at(-1)?.()); expect(frames.size).toBe(1); - expect(highlight).toHaveStyle({ width: "256px" }); + expect(highlight).toHaveStyle({ width: "256.25px" }); paint(); expect(highlight).toHaveStyle({ width: "404px" }); expect(highlight.style.transitionProperty).not.toBe("none"); diff --git a/webui/src/tests/workspace-picker.test.tsx b/webui/src/tests/workspace-picker.test.tsx index 58e598868..3a4e2255d 100644 --- a/webui/src/tests/workspace-picker.test.tsx +++ b/webui/src/tests/workspace-picker.test.tsx @@ -234,7 +234,7 @@ describe("Workspace project picker", () => { it.each([ ["/srv/alpha/", "/srv/beta/"], ["C:\\Projects\\alpha\\", "C:\\Projects\\beta\\"], - ])("distinguishes saved folders with the same name by their parent paths: %s", async (firstParent, secondParent) => { + ])("keeps same-named saved folders independently selectable by their full paths: %s", async (firstParent, secondParent) => { const user = userEvent.setup(); const firstPath = `${firstParent}src`; const secondPath = `${secondParent}src`; @@ -247,10 +247,8 @@ describe("Workspace project picker", () => { await user.click(screen.getByRole("button", { name: "Switch working directory" })); const first = await screen.findByRole("button", { name: firstPath }); const second = screen.getByRole("button", { name: secondPath }); - expect(within(first).getByText("src", { exact: true })).toBeInTheDocument(); - expect(within(first).getByText(firstParent, { exact: true })).toBeInTheDocument(); - expect(within(second).getByText("src", { exact: true })).toBeInTheDocument(); - expect(within(second).getByText(secondParent, { exact: true })).toBeInTheDocument(); + expect(first).toHaveTextContent(/^src$/); + expect(second).toHaveTextContent(/^src$/); act(() => first.focus()); expect(first).toHaveFocus(); await user.click(second);