Skip to content

Commit 6667dff

Browse files
committed
fix(web): remove mobile copy mode overflow
1 parent 6180dad commit 6667dff

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

e2e/specs/settings/mobile-copy-on-select.spec.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,10 +272,13 @@ test.describe("mobile copy on select", () => {
272272
const body = document.body;
273273
const doc = document.documentElement;
274274
const overlay = document.querySelector(".mobile-terminal-copy-mode");
275+
const toolbar = document.querySelector(".mobile-terminal-copy-mode__toolbar");
275276
const content = document.querySelector(".mobile-terminal-copy-mode__content");
276277
const text = document.querySelector(".mobile-terminal-copy-mode__text");
277278
const sheet = document.querySelector(".mobile-sheet--terminal");
278279
const terminalSheet = document.querySelector(".mobile-terminal-sheet");
280+
const xtermViewport = document.querySelector(".mobile-sheet--terminal .xterm-viewport");
281+
const xtermRows = document.querySelector(".mobile-sheet--terminal .xterm-rows");
279282
const viewportWidth = window.innerWidth;
280283
const viewportHeight = window.innerHeight;
281284

@@ -289,10 +292,17 @@ test.describe("mobile copy on select", () => {
289292
bodyScrollWidth: body.scrollWidth,
290293
bodyScrollHeight: body.scrollHeight,
291294
overlayRect: rect(overlay),
295+
toolbarRect: rect(toolbar),
292296
contentRect: rect(content),
293297
textRect: rect(text),
294298
sheetRect: rect(sheet),
295299
terminalSheetRect: rect(terminalSheet),
300+
xtermViewportRect: rect(xtermViewport),
301+
xtermRowsRect: rect(xtermRows),
302+
contentClientHeight: content instanceof HTMLElement ? content.clientHeight : null,
303+
contentScrollHeight: content instanceof HTMLElement ? content.scrollHeight : null,
304+
textClientHeight: text instanceof HTMLElement ? text.clientHeight : null,
305+
textScrollHeight: text instanceof HTMLElement ? text.scrollHeight : null,
296306
};
297307
});
298308

@@ -326,6 +336,10 @@ test.describe("mobile copy on select", () => {
326336
(beforeMetrics.terminalSheetRect?.height ?? 0)
327337
)
328338
).toBeLessThanOrEqual(1);
339+
expect(
340+
afterMetrics.contentScrollHeight,
341+
`copy mode content should not overflow by default:\n${JSON.stringify(afterMetrics, null, 2)}`
342+
).toBeLessThanOrEqual((afterMetrics.contentClientHeight ?? 0) + 1);
329343
});
330344

331345
test("mobile long press does not enter copy mode when copy on select is disabled", async ({

packages/web/src/styles/components.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9119,7 +9119,6 @@ textarea.input {
91199119
display: flex;
91209120
flex-direction: column;
91219121
min-height: 0;
9122-
padding: var(--sp-3);
91239122
box-sizing: border-box;
91249123
overflow: hidden;
91259124
background: color-mix(in srgb, var(--bg-terminal) 94%, var(--bg-page) 6%);
@@ -9132,6 +9131,7 @@ textarea.input {
91329131
display: flex;
91339132
align-items: center;
91349133
gap: var(--sp-2);
9134+
padding-inline: var(--sp-3);
91359135
padding-bottom: var(--sp-3);
91369136
}
91379137

@@ -9158,6 +9158,7 @@ textarea.input {
91589158
max-width: 100%;
91599159
max-height: 100%;
91609160
overflow: auto;
9161+
padding-inline: var(--sp-3);
91619162
user-select: text;
91629163
-webkit-user-select: text;
91639164
-webkit-touch-callout: default;

0 commit comments

Comments
 (0)