Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

fix(spaces-web): reserve the scrollbar gutter so Settings tabs don't shift sideways (CUA-2310) (#5974)

cua-agents[bot]a5076bba5470
diff --git a/apps/cua-spaces-web/e2e/settings-tab-layout.spec.ts b/apps/cua-spaces-web/e2e/settings-tab-layout.spec.ts
new file mode 100644
index 0000000000..d15bc34e58
--- /dev/null
+++ b/apps/cua-spaces-web/e2e/settings-tab-layout.spec.ts
@@ -0,0 +1,65 @@
+// SPDX-License-Identifier: FSL-1.1-MIT
+// Copyright (c) 2026 Cua AI, Inc.
+
+/**
+ * Settings tabs keep their place: General is long (the page scrolls), the
+ * others are short (it doesn't). The page's scrollbar must not take width
+ * from the column on one tab and not the other, or the tab bar and content
+ * jump sideways when you switch.
+ */
+
+import { expect, test } from "./host";
+
+const TABS = [
+ ["General", "/settings"],
+ ["Agents", "/settings/agents"],
+ ["Devices", "/settings/devices"],
+ ["Experiments", "/settings/experiments"],
+ ["About", "/settings/about"],
+] as const;
+
+// A short window, so General scrolls; a Settings tab bar and heading to measure.
+test.use({
+ viewport: { width: 1100, height: 520 },
+ // Headless Chromium hides scrollbars by default; a Mac window with a mouse
+ // (or "always show scrollbars") shows them, and they take width.
+ launchOptions: { ignoreDefaultArgs: ["--hide-scrollbars"] },
+});
+
+test("Settings: the heading, tab bar and content keep their left edge across tabs", async ({ page }) => {
+ await page.goto("/settings?bridge=demo&parity");
+ const nav = page.getByRole("navigation", { name: "Settings" });
+ await nav.waitFor();
+
+ type Edges = { heading: number; nav: number; content: number; scrolls: boolean };
+ const edges: Record<string, Edges> = {};
+ for (const [label] of TABS) {
+ await nav.getByRole("link", { name: label, exact: true }).click();
+ await expect(nav.getByRole("link", { name: label, exact: true })).toHaveAttribute("data-status", "active");
+ await page.waitForTimeout(150);
+ edges[label] = await page.evaluate(() => {
+ const nav = document.querySelector('nav[aria-label="Settings"]')!;
+ const scroller = nav.closest(".overflow-y-auto")!;
+ const first = nav.nextElementSibling;
+ return {
+ heading: document.querySelector("h1")!.getBoundingClientRect().left,
+ nav: nav.getBoundingClientRect().left,
+ content: first ? first.getBoundingClientRect().left : -1,
+ scrolls: scroller.scrollHeight > scroller.clientHeight,
+ };
+ });
+ }
+
+ // The test only means something if the tabs differ in length.
+ const scrolling = Object.values(edges).map((e) => e.scrolls);
+ expect(scrolling).toContain(true);
+ expect(scrolling).toContain(false);
+
+ const base = edges.General!;
+ for (const [label] of TABS) {
+ const e = edges[label]!;
+ expect({ heading: e.heading, nav: e.nav }, label).toEqual({ heading: base.heading, nav: base.nav });
+ // A tab with nothing to show yet (Experiments, none on) has no content to measure.
+ if (e.content >= 0) expect(e.content, label).toBe(base.content);
+ }
+});
diff --git a/apps/cua-spaces-web/src/components/page.tsx b/apps/cua-spaces-web/src/components/page.tsx
index 3d4a5439b5..258ec2ed40 100644
--- a/apps/cua-spaces-web/src/components/page.tsx
+++ b/apps/cua-spaces-web/src/components/page.tsx
@@ -6,8 +6,11 @@ import type { ReactNode } from "react";
import { cn } from "@/lib/utils";
export function Page({ children, className }: { children: ReactNode; className?: string }) {
+ // The gutter is always reserved: otherwise a page that scrolls (Settings >
+ // General) is narrower than one that doesn't, and the centred column jumps
+ // sideways between them.
return (
- <div className="h-full overflow-y-auto">
+ <div className="h-full overflow-y-auto [scrollbar-gutter:stable]">
<div className={cn("mx-auto w-full max-w-5xl px-8 pt-6 pb-16", className)}>{children}</div>
</div>
);