fix: size dashboard rails to viewport

This commit is contained in:
Thomas Camlong authored and ajnart committed 2026-08-14 11:07:07 +02:00
1 parent d3534dfcf8
commit 06aa5caf0b
4 files changed
+10 -7

No files matched your search

@@ -21,6 +21,7 @@
height: var(--board-gutter-viewport-height); height: var(--board-gutter-viewport-height);
padding-top: 24px; padding-top: 24px;
margin-top: -24px; margin-top: -24px;
overflow-x: hidden;
overflow-y: auto; overflow-y: auto;
overscroll-behavior: contain; overscroll-behavior: contain;
scrollbar-gutter: stable; scrollbar-gutter: stable;
@@ -10,9 +10,9 @@ The board uses fixed logical units:
Items keep the same logical dimensions at every viewport. The viewport reserves Items keep the same logical dimensions at every viewport. The viewport reserves
the painted size while the inner canvas remains at its logical dimensions, so a the painted size while the inner canvas remains at its logical dimensions, so a
widget's `clientWidth`, `clientHeight`, and `ResizeObserver` measurements stay widget's `clientWidth`, `clientHeight`, and `ResizeObserver` measurements stay
stable. The visual canvas always fits the available width, the main root keeps stable. The visual canvas always fits the available width, every root lane
at least one viewport of height, and edit-mode previews extend it downward as keeps at least one viewport of height, and edit-mode previews extend it downward
needed. as needed.
The read-only renderer should: The read-only renderer should:
@@ -147,10 +147,7 @@ export const SectionGrid = ({
); );
const displayedItems = items.map((item) => withPlacement(item, placementById.get(item.id))); const displayedItems = items.map((item) => withPlacement(item, placementById.get(item.id)));
const displayedInnerSections = innerSections.map((item) => withPlacement(item, placementById.get(item.id))); const displayedInnerSections = innerSections.map((item) => withPlacement(item, placementById.get(item.id)));
const minimumViewportRowCount = useMinimumViewportRowCount( const minimumViewportRowCount = useMinimumViewportRowCount(section.kind === "empty", canvasScale);
section.kind === "empty" && railPlacement === "main",
canvasScale,
);
const contentRowCount = Math.max(1, getLayoutRowCount(displayPlacements)); const contentRowCount = Math.max(1, getLayoutRowCount(displayPlacements));
const rowCount = Math.max(contentRowCount, requestedRowCount, minimumViewportRowCount); const rowCount = Math.max(contentRowCount, requestedRowCount, minimumViewportRowCount);
const logicalWidth = getLogicalTrackSize(columnCount); const logicalWidth = getLogicalTrackSize(columnCount);
+5
View File
@@ -95,6 +95,11 @@ describe("Board grid", () => {
await expect(rail).toBeVisible(); await expect(rail).toBeVisible();
await expect(rail).toHaveAttribute("data-board-gutter", "left"); await expect(rail).toHaveAttribute("data-board-gutter", "left");
await expect(railRootSection).toHaveAttribute("data-rail-placement", "left"); await expect(railRootSection).toHaveAttribute("data-rail-placement", "left");
await expect(rail).toHaveCSS("overflow-x", "hidden");
const initialRailBox = await expectBoundingBoxAsync(rail);
const initialRailRootBox = await expectBoundingBoxAsync(railRootSection);
expect(initialRailRootBox.width).toBeCloseTo(initialRailBox.width, 1);
expect(initialRailRootBox.height).toBeGreaterThanOrEqual(initialRailBox.height - 1);
await expect(railItem).toHaveAttribute("data-grid-x", "0"); await expect(railItem).toHaveAttribute("data-grid-x", "0");
await expect(containerSection).toHaveAttribute("data-grid-w", "2"); await expect(containerSection).toHaveAttribute("data-grid-w", "2");
await expect(containerSection).toHaveAttribute("data-grid-h", "2"); await expect(containerSection).toHaveAttribute("data-grid-h", "2");