Skip to content

Commit 861d1d5

Browse files
authored
fix(ui): lock the app root scroll in every host, not just standalone PWAs (#107102)
* fix(ui): lock the app root scroll in every host, not just standalone PWAs * fix(ui): size mount fallback scroller to the visible viewport
1 parent ef25cef commit 861d1d5

3 files changed

Lines changed: 39 additions & 20 deletions

File tree

‎ui/index.html‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,15 @@
8787

8888
.mount-fallback {
8989
box-sizing: border-box;
90-
min-height: 100vh;
90+
/* The app stylesheet clips the root scrollers, so this pre-app error
91+
surface must own its scrolling on short windows. dvh keeps the
92+
scroll range inside the visible mobile viewport; vh is the fallback. */
93+
height: 100vh;
94+
height: 100dvh;
95+
overflow-y: auto;
9196
padding: 24px;
9297
place-items: center;
98+
place-items: safe center;
9399
}
94100

95101
.mount-fallback:not([hidden]) {

‎ui/src/e2e/native-nav-sidebar-toggle.e2e.test.ts‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,31 @@ describeControlUiE2e("Control UI native-nav sidebar toggle E2E", () => {
255255
await expect.poll(() => toolbar.getByRole("button", { name: "New session" }).count()).toBe(0);
256256
});
257257

258+
it("keeps the document root scroll-locked in the Settings takeover", async () => {
259+
const page = await openPage({ webChrome: true });
260+
const response = await page.goto(`${server.baseUrl}settings/general`);
261+
expect(response?.status()).toBe(200);
262+
await page.locator(".settings-sidebar").waitFor({ state: "visible" });
263+
264+
// WKWebView scrolls the document whenever it overflows, dragging the
265+
// settings sidebar and content along. Force overflow the way stray
266+
// content would, then confirm the root refuses to move.
267+
const metrics = await page.evaluate(() => {
268+
const spacer = document.createElement("div");
269+
spacer.style.height = "3000px";
270+
document.body.append(spacer);
271+
window.scrollTo(0, 500);
272+
document.documentElement.scrollTop = 500;
273+
document.body.scrollTop = 500;
274+
return {
275+
bodyScrollTop: document.body.scrollTop,
276+
htmlScrollTop: document.documentElement.scrollTop,
277+
rootScrollY: window.scrollY,
278+
};
279+
});
280+
expect(metrics).toEqual({ bodyScrollTop: 0, htmlScrollTop: 0, rootScrollY: 0 });
281+
});
282+
258283
it("keeps the drawer hamburger at narrow widths in plain browsers", async () => {
259284
const page = await openPage({ nativeNav: false, width: 900 });
260285
await expect.poll(() => page.locator(".topbar-nav-toggle").isVisible()).toBe(true);

‎ui/src/styles/base.css‎

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -509,9 +509,12 @@
509509
html,
510510
body {
511511
height: 100%;
512-
/* App shell: inner panes scroll, the root never should. Without this the
513-
macOS WKWebView (Mac app) and Safari rubber-band the whole window, even
514-
when nothing overflows. */
512+
/* App shell: inner panes scroll, the root never does — in every host
513+
(browser tab, PWA, Mac app WKWebView). WKWebView drag/rubber-band scrolls
514+
the document even when nothing overflows, dragging the whole shell with
515+
it; `clip` also blocks programmatic root scrolls (focus/scrollIntoView)
516+
that `hidden` would let strand the shell off-screen. */
517+
overflow: clip;
515518
overscroll-behavior: none;
516519
/* iOS WKWebView font boosting inflates rendered text without re-running
517520
layout, so labels spill out of fixed-size chrome (welcome chips, badges).
@@ -573,17 +576,10 @@ openclaw-app {
573576
display: block;
574577
position: relative;
575578
z-index: 1;
576-
min-height: 100vh;
579+
height: 100%;
577580
}
578581

579582
@media (display-mode: standalone) {
580-
html,
581-
body {
582-
width: 100%;
583-
height: 100%;
584-
overflow: hidden;
585-
}
586-
587583
@supports (height: 100dvh) {
588584
html,
589585
body {
@@ -599,14 +595,6 @@ openclaw-app {
599595
padding-bottom: var(--safe-area-bottom);
600596
padding-left: var(--safe-area-left);
601597
}
602-
603-
openclaw-app {
604-
width: 100%;
605-
height: 100%;
606-
min-width: 0;
607-
min-height: 0;
608-
overflow: hidden;
609-
}
610598
}
611599

612600
/* Cursor convention: app chrome (buttons, menus, tabs, rails, controls) uses

0 commit comments

Comments
 (0)