fix: smooth container collapse behavior
This commit is contained in:
1 parent
dd11fd8381
commit
0b1c2f856f
3 files changed
+58
-16
No files matched your search
@@ -66,13 +66,13 @@ export const BoardContainerSection = ({ section }: Props) => {
|
|||||||
<Button
|
<Button
|
||||||
className={classes.containerToggle}
|
className={classes.containerToggle}
|
||||||
pos="absolute"
|
pos="absolute"
|
||||||
top={isVisuallyCollapsed ? 0 : -28}
|
top={isVisuallyCollapsed ? 0 : -24}
|
||||||
left={0}
|
left={0}
|
||||||
w="100%"
|
w="100%"
|
||||||
h={isVisuallyCollapsed ? "100%" : 28}
|
h={isVisuallyCollapsed ? "100%" : 24}
|
||||||
px={12}
|
px={12}
|
||||||
pe={options.showOpenAll ? 40 : 12}
|
pe={options.showOpenAll ? 40 : 12}
|
||||||
radius={isVisuallyCollapsed ? board.itemRadius : "sm"}
|
radius={board.itemRadius}
|
||||||
variant="default"
|
variant="default"
|
||||||
justify={options.showLabel ? "flex-start" : "center"}
|
justify={options.showLabel ? "flex-start" : "center"}
|
||||||
leftSection={
|
leftSection={
|
||||||
@@ -145,8 +145,8 @@ export const BoardContainerSection = ({ section }: Props) => {
|
|||||||
{options.showOpenAll && !isEditMode && (
|
{options.showOpenAll && !isEditMode && (
|
||||||
<ActionIcon
|
<ActionIcon
|
||||||
pos="absolute"
|
pos="absolute"
|
||||||
top={isVisuallyCollapsed ? "50%" : -26}
|
top={isVisuallyCollapsed ? "50%" : -24}
|
||||||
right={2}
|
right={0}
|
||||||
style={{ zIndex: 10, transform: isVisuallyCollapsed ? "translateY(-50%)" : undefined }}
|
style={{ zIndex: 10, transform: isVisuallyCollapsed ? "translateY(-50%)" : undefined }}
|
||||||
variant={options.collapsible ? "subtle" : "default"}
|
variant={options.collapsible ? "subtle" : "default"}
|
||||||
size={24}
|
size={24}
|
||||||
@@ -158,15 +158,20 @@ export const BoardContainerSection = ({ section }: Props) => {
|
|||||||
<IconExternalLink size={16} />
|
<IconExternalLink size={16} />
|
||||||
</ActionIcon>
|
</ActionIcon>
|
||||||
)}
|
)}
|
||||||
<Box id={contentId} h="100%" hidden={isVisuallyCollapsed}>
|
<Box
|
||||||
{!isVisuallyCollapsed && (
|
id={contentId}
|
||||||
<SectionGrid
|
className={classes.containerBody}
|
||||||
section={section}
|
h="100%"
|
||||||
columnCount={section.width}
|
data-collapsed={isVisuallyCollapsed ? "true" : "false"}
|
||||||
requestedRowCount={section.height}
|
aria-hidden={isVisuallyCollapsed}
|
||||||
label={label}
|
inert={isVisuallyCollapsed}
|
||||||
/>
|
>
|
||||||
)}
|
<SectionGrid
|
||||||
|
section={section}
|
||||||
|
columnCount={section.width}
|
||||||
|
requestedRowCount={section.height}
|
||||||
|
label={label}
|
||||||
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
</Card>
|
</Card>
|
||||||
{isEditMode && <BoardContainerMenu section={section} />}
|
{isEditMode && <BoardContainerMenu section={section} />}
|
||||||
|
|||||||
@@ -41,3 +41,27 @@
|
|||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.containerBody {
|
||||||
|
visibility: visible;
|
||||||
|
opacity: 1;
|
||||||
|
transition:
|
||||||
|
opacity 140ms ease 80ms,
|
||||||
|
visibility 0s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.containerBody[data-collapsed="true"] {
|
||||||
|
visibility: hidden;
|
||||||
|
pointer-events: none;
|
||||||
|
opacity: 0;
|
||||||
|
transition:
|
||||||
|
opacity 120ms ease,
|
||||||
|
visibility 0s linear 120ms;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (prefers-reduced-motion: reduce) {
|
||||||
|
.containerBody,
|
||||||
|
.containerBody[data-collapsed="true"] {
|
||||||
|
transition: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
+15
-2
@@ -127,6 +127,8 @@ describe("Board grid", () => {
|
|||||||
await expect(logicalTile).toHaveCount(1);
|
await expect(logicalTile).toHaveCount(1);
|
||||||
await expectFixedLogicalTileAsync(logicalTile);
|
await expectFixedLogicalTileAsync(logicalTile);
|
||||||
await expect(logicalTile).toHaveCSS("overflow", "hidden");
|
await expect(logicalTile).toHaveCSS("overflow", "hidden");
|
||||||
|
await page.addStyleTag({ content: ".e2e-widget-overflow { overflow: visible; }" });
|
||||||
|
await expect(secondItem.locator("[data-grid-item-content]")).toHaveCSS("overflow", "visible");
|
||||||
await expect(canvas).toHaveAttribute("data-canvas-overflow", "false");
|
await expect(canvas).toHaveAttribute("data-canvas-overflow", "false");
|
||||||
await expectDocumentNotHorizontallyScrollableAsync(page);
|
await expectDocumentNotHorizontallyScrollableAsync(page);
|
||||||
const nestedAppLink = nestedItem.locator('a[href="#board-app-opened"]');
|
const nestedAppLink = nestedItem.locator('a[href="#board-app-opened"]');
|
||||||
@@ -186,10 +188,15 @@ describe("Board grid", () => {
|
|||||||
name: "Collapse: Nested box",
|
name: "Collapse: Nested box",
|
||||||
exact: true,
|
exact: true,
|
||||||
});
|
});
|
||||||
|
await nestedItem.evaluate((element) => {
|
||||||
|
element.setAttribute("data-e2e-preserved-through-collapse", "true");
|
||||||
|
});
|
||||||
await collapseContainer.click();
|
await collapseContainer.click();
|
||||||
await expect(containerSection).toHaveAttribute("data-grid-h", "0.5");
|
await expect(containerSection).toHaveAttribute("data-grid-h", "0.5");
|
||||||
await expect(belowItem).toHaveAttribute("data-grid-y", "0.5");
|
await expect(belowItem).toHaveAttribute("data-grid-y", "0.5");
|
||||||
await expect(nestedItem).toHaveCount(0);
|
await expect(nestedItem).toBeHidden();
|
||||||
|
await expect(nestedItem).toHaveAttribute("data-e2e-preserved-through-collapse", "true");
|
||||||
|
await expect(containerSection.locator("[data-collapsed='true']")).toHaveAttribute("inert", "");
|
||||||
const collapsedControl = containerSection.getByRole("button", { name: "Expand: Nested box", exact: true });
|
const collapsedControl = containerSection.getByRole("button", { name: "Expand: Nested box", exact: true });
|
||||||
await expect(collapsedControl).toBeVisible();
|
await expect(collapsedControl).toBeVisible();
|
||||||
await expect(collapsedControl).toHaveAttribute("data-board-container-collapsed-control", "true");
|
await expect(collapsedControl).toHaveAttribute("data-board-container-collapsed-control", "true");
|
||||||
@@ -212,7 +219,8 @@ describe("Board grid", () => {
|
|||||||
.click();
|
.click();
|
||||||
await expect(containerSection).toHaveAttribute("data-grid-h", "2");
|
await expect(containerSection).toHaveAttribute("data-grid-h", "2");
|
||||||
await expect(belowItem).toHaveAttribute("data-grid-y", "2");
|
await expect(belowItem).toHaveAttribute("data-grid-y", "2");
|
||||||
await expect(nestedItem).toHaveCount(1);
|
await expect(nestedItem).toBeVisible();
|
||||||
|
await expect(nestedItem).toHaveAttribute("data-e2e-preserved-through-collapse", "true");
|
||||||
await captureBoardScreenshotAsync(canvas, screenshotDirectory, "board-grid-read-only.png");
|
await captureBoardScreenshotAsync(canvas, screenshotDirectory, "board-grid-read-only.png");
|
||||||
|
|
||||||
const viewMainSectionBox = await expectBoundingBoxAsync(mainSection);
|
const viewMainSectionBox = await expectBoundingBoxAsync(mainSection);
|
||||||
@@ -1041,6 +1049,11 @@ const seedBoardGridAsync = async (db: SqliteDatabase, creatorId: string) => {
|
|||||||
boardId,
|
boardId,
|
||||||
kind: "clock",
|
kind: "clock",
|
||||||
options: stringifySuperJSON({ is24HourFormat: true }),
|
options: stringifySuperJSON({ is24HourFormat: true }),
|
||||||
|
advancedOptions: stringifySuperJSON({
|
||||||
|
title: null,
|
||||||
|
customCssClasses: ["e2e-widget-overflow"],
|
||||||
|
borderColor: "",
|
||||||
|
}),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: belowItemId,
|
id: belowItemId,
|
||||||
|
|||||||
Reference in new issue
Block a user