From b911af8644bf3cec06043f33f561f9e15aaebfe9 Mon Sep 17 00:00:00 2001 From: Saurav Shakya Date: Sun, 22 Nov 2026 06:32:58 +0000 Subject: [PATCH] fix(design-v2): keep the Text step editor usable at mobile widths Under 960px the editor column and the help rail stack, and the Text step's editor card shrank to about 5px on a 390px-wide phone, so the template could not be read or edited. Give it the same treatment the Logic step got in #1104: let the body scroll and give the editor a height of its own (clamp(260px, 45vh, 380px)). Add an e2e test that opens the Text step at 390x844 and checks the editor height; it fails without this change. Signed-off-by: Saurav Shakya --- e2e/design-v2-mobile.spec.ts | 26 ++++++++++++++++++++++ src/components/designV2/DesignV2Layout.css | 11 +++++++++ 2 files changed, 37 insertions(+) create mode 100644 e2e/design-v2-mobile.spec.ts diff --git a/e2e/design-v2-mobile.spec.ts b/e2e/design-v2-mobile.spec.ts new file mode 100644 index 00000000..0007ccd0 --- /dev/null +++ b/e2e/design-v2-mobile.spec.ts @@ -0,0 +1,26 @@ +import { test, expect } from '@playwright/test'; + +/** + * Design v2 at a phone width. Under 960px the editor column and the help rail + * stack, and the editor still has to leave room to read and edit the template. + */ +test.use({ + storageState: { cookies: [], origins: [] }, + viewport: { width: 390, height: 844 }, +}); + +test.describe('Design v2 at mobile widths', () => { + test('the Text step editor keeps a usable height', async ({ page }) => { + await page.goto('/'); + + await page.getByRole('button', { name: 'Got it' }).click(); + await page.getByRole('button', { name: /Start building/ }).click(); + await page.getByRole('button', { name: 'Start with Consulting Agreement' }).click(); + + const editor = page.getByRole('region', { name: 'Text' }).locator('.monaco-editor'); + await expect(editor).toBeVisible({ timeout: 30000 }); + + const box = await editor.boundingBox(); + expect(box?.height ?? 0).toBeGreaterThanOrEqual(200); + }); +}); diff --git a/src/components/designV2/DesignV2Layout.css b/src/components/designV2/DesignV2Layout.css index af196a42..58f57e13 100644 --- a/src/components/designV2/DesignV2Layout.css +++ b/src/components/designV2/DesignV2Layout.css @@ -763,6 +763,17 @@ html[data-theme="dark"] .nd-sim-pane-ok .nd-sim-tabs .ant-tabs-nav { background: .nd-view-logic .nd-logic-editor { display: flex; flex: none; width: 100%; height: clamp(260px, 45vh, 380px); min-height: 260px; padding: 0; overflow: hidden; } .nd-view-logic .nd-logic-editor .editorwrapper { flex: 1; width: 100%; height: 100%; min-width: 0; min-height: 0; } .nd-view-logic .nd-help-rail { max-height: none; overflow: visible; } + /* + * The Text step stacks the same way: its editor card is a flex child of a + * column the help rail shares, so on a phone it shrinks to a few pixels. + * Let the body scroll and give the editor a height of its own, as above. + */ + .nd-body-content:has(.nd-view-text) { overflow-y: auto; } + .nd-view-text { min-height: 0; overflow: visible; } + .nd-view-text .nd-editor-column { flex: none; min-height: auto; overflow: visible; } + .nd-view-text .nd-editor-card { flex: none; } + .nd-view-text .nd-editor-card-body-editor { flex: none; height: clamp(260px, 45vh, 380px); } + .nd-view-text .nd-help-rail { max-height: none; overflow: visible; } } /* Phones: the chip list takes a row of its own so each chip can wrap inside the card. */ @media (max-width: 600px) {