From e02cbddb142680e8eeb17a6d46f4ddc8da984c0c Mon Sep 17 00:00:00 2001 From: yiling Date: Mon, 2 Nov 2026 22:19:40 +0800 Subject: [PATCH] fix(webui): prevent manage versions dialog overflow on long file names --- CHANGELOG.md | 2 + apps/web/e2e/README.md | 1 + .../project/version-stack-manage.spec.ts | 73 +++++++++++++++++++ .../components/manage-versions-dialog.tsx | 6 +- 4 files changed, 79 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f1894348..ffad9edb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). ### Fixed +- **asset**: Fix an issue where version cards in the manage versions dialog horizontally overflowed when containing long file names + ### Changed ## [0.6.3] - 2026-11-01 diff --git a/apps/web/e2e/README.md b/apps/web/e2e/README.md index 0978d70c..178aae2e 100644 --- a/apps/web/e2e/README.md +++ b/apps/web/e2e/README.md @@ -90,6 +90,7 @@ apps/web/e2e/ | Owner removes version from 2-version stack which dissolves into standalone files | `tests/project/version-stack-manage.spec.ts` | | Dissolving a shared version stack renders the remaining standalone file name on the share page | `tests/project/version-stack-manage.spec.ts` | | Moving a shared file into a shared version stack leaves only 1 stack card on the share page | `tests/project/version-stack-manage.spec.ts` | +| Manage versions dialog constrains card width and truncates long file names without dialog overflow | `tests/project/version-stack-manage.spec.ts` | | Owner searches the file list by an English name keyword | `tests/project/search-file-list.spec.ts` | | Owner searches the file list by Chinese, Japanese, and Korean name keywords | `tests/project/search-file-list.spec.ts` | | Owner searches the file list with a keyword and a filter condition | `tests/project/search-file-list.spec.ts` | diff --git a/apps/web/e2e/tests/project/version-stack-manage.spec.ts b/apps/web/e2e/tests/project/version-stack-manage.spec.ts index 8221a39b..4891f695 100644 --- a/apps/web/e2e/tests/project/version-stack-manage.spec.ts +++ b/apps/web/e2e/tests/project/version-stack-manage.spec.ts @@ -231,3 +231,76 @@ test('moving a shared file into a shared version stack leaves only 1 stack card const updatedShareRoot = await prisma.asset.findUnique({ where: { id: share.rootFolderId } }) expect(updatedShareRoot?.fileCount).toBe(1) }) + +test('manage versions dialog constrains card width and truncates long file names without dialog overflow', async ({ + project, + prisma, +}) => { + const { page, projectId, rootFolderId } = project + + const longName = + 'super-extremely-long-asset-name-for-testing-manage-versions-dialog-card-overflow-issue-that-keeps-expanding-without-truncating-properly.mp4' + const fileA = await seedFile(prisma, projectId, rootFolderId, longName) + const fileB = await seedFile(prisma, projectId, rootFolderId, `short-${Date.now()}.mp4`) + + await page.goto(`/projects/${projectId}`) + await expect(fileCard(page, fileA.name)).toBeVisible() + await expect(fileCard(page, fileB.name)).toBeVisible() + + // Create version stack: drag B on A + await dragCard(page, fileCard(page, fileB.name), fileCard(page, fileA.name)) + await expect(page.getByText('v2', { exact: true })).toBeVisible() + + const stack = await prisma.asset.findFirstOrThrow({ + where: { projectId, parentId: rootFolderId, type: 'version_stack' }, + }) + + // Navigate to file viewer for the stack + await page.goto(`/projects/${projectId}/files/${stack.id}`) + + // Open breadcrumb menu and click "Manage versions..." + await page.getByRole('button', { name: new RegExp(fileB.name) }).click() + await page.getByRole('menuitem', { name: 'Versions', exact: true }).hover() + await page.getByRole('button', { name: /manage versions$/i }).click() + + const dialog = page.getByRole('dialog') + await expect(dialog).toBeVisible() + + const rowA = dialog.locator('div.group', { hasText: longName }) + await expect(rowA).toBeVisible() + + // Measure the dialog and version row + const metrics = await page.evaluate(() => { + const dialogEl = document.querySelector('[role="dialog"]') as HTMLElement | null + if (!dialogEl) return null + const row = dialogEl.querySelector('div.group') as HTMLElement | null + return { + dialogScrollWidth: dialogEl.scrollWidth, + dialogClientWidth: dialogEl.clientWidth, + dialogOffsetWidth: dialogEl.offsetWidth, + rowScrollWidth: row?.scrollWidth, + rowClientWidth: row?.clientWidth, + } + }) + + expect(metrics).not.toBeNull() + // Dialog should not horizontally scroll or overflow + expect(metrics!.dialogScrollWidth).toBeLessThanOrEqual(metrics!.dialogClientWidth) + // Row clientWidth should be bounded within the dialog + expect(metrics!.rowClientWidth).toBeLessThanOrEqual(metrics!.dialogClientWidth) + expect(metrics!.rowScrollWidth).toBeLessThanOrEqual(metrics!.rowClientWidth!) + + // Hover over the row and verify the more-options button is visible and within bounds + await rowA.hover() + const moreButton = rowA.getByRole('button', { name: 'More options' }) + await expect(moreButton).toBeVisible() + const moreBtnBox = await moreButton.boundingBox() + const dialogBox = await dialog.boundingBox() + expect(moreBtnBox).not.toBeNull() + expect(dialogBox).not.toBeNull() + expect(moreBtnBox!.x + moreBtnBox!.width).toBeLessThanOrEqual(dialogBox!.x + dialogBox!.width) + + // Click more options button and verify menu opens + await moreButton.click() + await expect(page.getByRole('menuitem', { name: /remove from stack/i })).toBeVisible() +}) diff --git a/packages/webui/components/manage-versions-dialog.tsx b/packages/webui/components/manage-versions-dialog.tsx index 4acabbcc..d65b4c4e 100644 --- a/packages/webui/components/manage-versions-dialog.tsx +++ b/packages/webui/components/manage-versions-dialog.tsx @@ -411,12 +411,12 @@ export function ManageVersionsDialog({ return ( - - + + {m.manage_versions_title()} - + {isLoading ? (
{m.loading?.() || 'Loading...'}