Skip to content

Commit e9d6624

Browse files
committed
fix(ui): keep status bar inside resized viewport
Allow the terminal workspace grid item to shrink below xterm's previous min-content width so desktop-to-mobile resizes do not stretch and clip the status bar. Cover the immediate 1280x800 to 375x812 transition in Playwright.
1 parent 997ae1b commit e9d6624

2 files changed

Lines changed: 24 additions & 2 deletions

File tree

apps/web/e2e/terminal.spec.ts

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,32 @@ test("new tab starts a distinct active session by default", async ({
7777
});
7878

7979
// @trace FR-5 e2e-viewport-resize-stability
80-
test("stays stable through viewport resizes", async ({ page }) => {
80+
test("keeps terminal and status bar stable through viewport resizes", async ({
81+
page,
82+
}) => {
8183
await page.goto("/");
8284
await waitUntilConnected(page);
8385

84-
await page.setViewportSize({ width: 420, height: 900 });
86+
await page.setViewportSize({ width: 1280, height: 800 });
87+
await page.setViewportSize({ width: 375, height: 812 });
88+
89+
const mobileLayout = await page.evaluate(() => {
90+
const statusbar = document.querySelector(".statusbar");
91+
if (!(statusbar instanceof HTMLElement)) {
92+
throw new Error("Status bar was not rendered");
93+
}
94+
95+
return {
96+
viewportWidth: window.innerWidth,
97+
statusbarRight: statusbar.getBoundingClientRect().right,
98+
};
99+
});
100+
101+
expect(
102+
mobileLayout.statusbarRight,
103+
"status bar should stay within the viewport while shrinking to mobile",
104+
).toBeLessThanOrEqual(mobileLayout.viewportWidth);
105+
85106
await waitUntilConnected(page);
86107
await expect(page.getByTestId("terminal-wrap")).toBeVisible();
87108

apps/web/src/styles/layout.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848

4949
.workspace {
5050
position: relative;
51+
min-width: 0;
5152
min-height: 0;
5253
}
5354

0 commit comments

Comments
 (0)