From a2faf00c896a8c06cbd353dc6a622257df8f865c Mon Sep 17 00:00:00 2001 From: Adam Malczewski Date: Mon, 7 Sep 2026 17:52:37 +0900 Subject: feat(workspaces): content-driven canvas while dragging — scrollbar grows/shrinks with the gesture MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Revert the fixed append-canvas reservation (9ede1f0): pre-reserving the 3 spaces at drag start made the view jump right and created far too much free canvas. The grid is back to hugging its content (width: max-content / auto), so the preview extends the canvas as the tile reaches toward the edge and it shrinks back when the gesture ends — the scrollbar moves with the drag, as intended. The drag-target clamp (dragAppendLimit, +3 past the committed edge) still bounds how far the preview can extend, so the "endless growth" problem stays solved without reserving anything up front. Dots restore the one-pitch padding extension for the append slot; the scroll-measure effect still re-runs on drag start/end (the canvas shrinks back on cancel). Test reverted to the content-driven assertions. Verification: svelte-check 0 errors/0 warnings; vitest 1693/1693; biome clean on touched files; build ok. --- src/features/workspaces/ui/HomeTileGrid.test.ts | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'src/features/workspaces/ui/HomeTileGrid.test.ts') diff --git a/src/features/workspaces/ui/HomeTileGrid.test.ts b/src/features/workspaces/ui/HomeTileGrid.test.ts index 9f163fd..d70c673 100644 --- a/src/features/workspaces/ui/HomeTileGrid.test.ts +++ b/src/features/workspaces/ui/HomeTileGrid.test.ts @@ -105,18 +105,10 @@ describe("HomeTileGrid", () => { }); const wrapper = screen.getByRole("button", { name: "Open workspace Workspace A" }); - const grid = container.querySelector(".grid"); // The cell math resolves against the grid element's rect (jsdom: 0s). fireEvent.pointerDown(wrapper, { button: 0, clientX: 10, clientY: 10, pointerType: "mouse" }); fireEvent.pointerMove(wrapper, { clientX: 80, clientY: 40 }); - // While dragging the canvas is a FIXED reservation (content edge + 3, plus - // the dragged tile's span room) — never max-content, so the scroller can't - // resize mid-drag. - const pitchX = WIDE.unit.width + WIDE.unit.gap; - expect(grid?.getAttribute("style")).toContain(`width: ${5 * pitchX - WIDE.unit.gap}px`); - expect(grid?.getAttribute("style")).not.toContain("width: max-content"); - // The dashed landing ghost appears… const ghost = container.querySelector("[aria-hidden='true'].border-dashed"); expect(ghost).not.toBeNull(); @@ -127,8 +119,6 @@ describe("HomeTileGrid", () => { fireEvent.pointerUp(wrapper); // The ghost + follow disappear on drop… expect(container.querySelector("[aria-hidden='true'].border-dashed")).toBeNull(); - // …and the reservation is gone too (the canvas hugs the committed content). - expect(grid?.getAttribute("style")).toContain("width: max-content"); // …and the drop committed a PLACE at the hovered cell (a lands where it // already was — the pointer hovered its own slot; a no-move drop). expect(props.onPlace).toHaveBeenCalledWith("a", { col: 1, row: 1 }); -- cgit v1.2.3