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): the New Space image list is no longer cut off by the System card (#6202)

ddupontd15e235e0908
diff --git a/apps/cua-spaces-web/e2e/image-dropdown.spec.ts b/apps/cua-spaces-web/e2e/image-dropdown.spec.ts
new file mode 100644
index 0000000000..575adfb485
--- /dev/null
+++ b/apps/cua-spaces-web/e2e/image-dropdown.spec.ts
@@ -0,0 +1,37 @@
+// SPDX-License-Identifier: FSL-1.1-MIT
+// Copyright (c) 2026 Cua AI, Inc.
+
+/**
+ * New Space, step 1: the Image list floats over the rows under its field and
+ * is not cut off by the System card or the dialog. Every image the core
+ * offers for the chosen system is drawn, and each one is reachable (the list
+ * scrolls when it is long).
+ */
+
+import { expect, test } from "./host";
+
+test("the image list is not clipped by the System card", async ({ page }) => {
+ await page.goto("/spaces?bridge=demo&parity");
+ await page.getByRole("button", { name: /New Space/ }).first().click();
+ const wizard = page.locator("[data-new-space]");
+ await expect(wizard).toHaveAttribute("data-step", "0");
+ await wizard.locator("[data-image-toggle]").click();
+ const list = wizard.locator("[data-image-suggestions]");
+ await expect(list).toBeVisible();
+ const rows = list.locator("[data-image-row]");
+ const count = await rows.count();
+ expect(count).toBeGreaterThan(1);
+ const card = wizard.locator("[data-grouped]").first();
+ const cardBox = (await card.boundingBox())!;
+ const listBox = (await list.boundingBox())!;
+ // The list is drawn past the card's bottom edge instead of ending there.
+ expect(listBox.y + listBox.height).toBeGreaterThan(cardBox.y + cardBox.height);
+ // Every row is the topmost thing at its centre once scrolled to.
+ for (let i = 0; i < count; i++) {
+ const row = rows.nth(i);
+ await row.scrollIntoViewIfNeeded();
+ const box = (await row.boundingBox())!;
+ const hit = await row.evaluate((el, p) => el.contains(document.elementFromPoint(p.x, p.y)), { x: box.x + box.width / 2, y: box.y + box.height / 2 });
+ expect(hit, `row ${i} is drawn and not covered or clipped`).toBe(true);
+ }
+});
diff --git a/apps/cua-spaces-web/src/components/new-space/image-field.tsx b/apps/cua-spaces-web/src/components/new-space/image-field.tsx
index 83400c0e2c..8b4ea0ea5a 100644
--- a/apps/cua-spaces-web/src/components/new-space/image-field.tsx
+++ b/apps/cua-spaces-web/src/components/new-space/image-field.tsx
@@ -2,7 +2,7 @@
// Copyright (c) 2026 Cua AI, Inc.
import { ChevronsUpDownIcon } from "lucide-react";
-import type { KeyboardEvent } from "react";
+import { type KeyboardEvent, useEffect, useRef } from "react";
import type { ImageFieldView, WizardAction } from "@/bridge";
import { Input } from "@/components/ui/input";
@@ -27,6 +27,11 @@ export function ImageField({
view: ImageFieldView;
send: (action: WizardAction) => void;
}) {
+ const list = useRef<HTMLDivElement>(null);
+ // The list can reach past the dialog's scrolling body: bring it into view.
+ useEffect(() => {
+ if (view.open) list.current?.scrollIntoView?.({ block: "nearest" });
+ }, [view.open]);
const active = view.groups.flatMap((g) => g.rows).find((r) => r.highlighted);
const onKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {
@@ -96,6 +101,7 @@ export function ImageField({
{view.open ? (
<div
id="ns-image-suggestions"
+ ref={list}
role="listbox"
aria-label={label}
data-image-suggestions=""
diff --git a/apps/cua-spaces-web/src/components/new-space/new-space-dialog.tsx b/apps/cua-spaces-web/src/components/new-space/new-space-dialog.tsx
index 844d7f56f9..3502902b04 100644
--- a/apps/cua-spaces-web/src/components/new-space/new-space-dialog.tsx
+++ b/apps/cua-spaces-web/src/components/new-space/new-space-dialog.tsx
@@ -168,8 +168,9 @@ function Steps({ steps }: { steps: WizardView["steps"] }) {
/* ---- Layout ---------------------------------------------------------------- */
function Group({ children, className, ...rest }: { children: ReactNode; className?: string } & Record<`data-${string}`, string>) {
+ // Not clipped: the image field's suggestions float over the rows below the card's edge.
return (
- <GroupedSection className={className} {...rest}>
+ <GroupedSection className={className} contentClassName="overflow-visible" {...rest}>
{children}
</GroupedSection>
);
diff --git a/apps/cua-spaces-web/src/components/ui/grouped.tsx b/apps/cua-spaces-web/src/components/ui/grouped.tsx
index f440dc4675..85a0ec3b14 100644
--- a/apps/cua-spaces-web/src/components/ui/grouped.tsx
+++ b/apps/cua-spaces-web/src/components/ui/grouped.tsx
@@ -65,12 +65,13 @@ export function GroupedSection({
footer,
children,
className,
+ contentClassName,
...props
-}: { title?: ReactNode; action?: ReactNode; footer?: ReactNode } & Omit<Div, "title">) {
+}: { title?: ReactNode; action?: ReactNode; footer?: ReactNode; contentClassName?: string } & Omit<Div, "title">) {
return (
<section className={cn("min-w-0", className)}>
{title ? <SectionHeading action={action}>{title}</SectionHeading> : null}
- <div data-grouped="" className="overflow-hidden rounded-lg border bg-card [&>*+*]:border-t" {...props}>
+ <div data-grouped="" className={cn("overflow-hidden rounded-lg border bg-card [&>*+*]:border-t", contentClassName)} {...props}>
{children}
</div>
{footer ? <div className="mt-1.5 px-1 text-xs text-muted-foreground">{footer}</div> : null}