Skip to content

Your lightweight open-source personal agent.

style(webui): refine composer surface and workspace hover (#6444)

chengyongru4f7c4f088559
diff --git a/webui/browser/composer-action-fixture.tsx b/webui/browser/composer-action-fixture.tsx
index cb6edb965..00411c556 100644
--- a/webui/browser/composer-action-fixture.tsx
+++ b/webui/browser/composer-action-fixture.tsx
@@ -8,6 +8,7 @@ export function ComposerActionFixture({ parameters }: { parameters: URLSearchPar
<ThreadComposer
variant={parameters.get("composerVariant") === "thread" ? "thread" : "hero"}
modelLabel="Preview"
+ goalState={parameters.has("goal") ? { active: true, objective: "Keep the work in focus." } : undefined}
isStreaming={running}
onTranscribeAudio={async () => "Voice draft"}
onSend={() => { setStopRequested(false); setRunning(true); }}
diff --git a/webui/browser/composer-surface.spec.ts b/webui/browser/composer-surface.spec.ts
new file mode 100644
index 000000000..f46f5d566
--- /dev/null
+++ b/webui/browser/composer-surface.spec.ts
@@ -0,0 +1,59 @@
+import { expect, test } from "@playwright/test";
+
+test.beforeEach(async ({ page }) => {
+ await page.route("**/api/commands", route => route.fulfill({ json: { commands: [] } }));
+});
+
+for (const theme of ["light", "dark"]) {
+ test.describe(theme, () => {
+ test.beforeEach(async ({ page }) => {
+ await page.addInitScript((theme) => {
+ localStorage.setItem("nanobot.locale", "en");
+ localStorage.setItem("nanobot-webui.theme", theme);
+ document.documentElement.classList.toggle("dark", theme === "dark");
+ }, theme);
+ });
+
+ test("composer focus keeps the surface and actions stable", async ({ page }) => {
+ await page.goto(`/browser/fixture.html?case=new-chat-skeleton${theme === "dark" ? "&dark" : ""}`);
+ const surface = page.locator(".thread-composer-surface");
+ await expect(surface).toBeVisible();
+ const input = page.getByRole("textbox", { name: "Message input" });
+ await input.blur();
+ await page.getByTestId("hero-greeting").click();
+ const rest = await surface.evaluate(element => getComputedStyle(element).boxShadow);
+ const bounds = await surface.boundingBox();
+ const footer = await page.locator(".thread-composer-footer").boundingBox();
+ await input.focus();
+ await expect(input).toBeFocused();
+ await expect.poll(() => surface.evaluate(element => getComputedStyle(element).boxShadow)).toBe(rest);
+ expect(await surface.boundingBox()).toEqual(bounds);
+ expect(await page.locator(".thread-composer-footer").boundingBox()).toEqual(footer);
+ await input.fill("Keep the work in focus.");
+ await expect(input).toHaveValue("Keep the work in focus.");
+ });
+
+ test("composer focus preserves the active goal's blue ring", async ({ page }) => {
+ await page.emulateMedia({ reducedMotion: "reduce" });
+ await page.goto("/browser/fixture.html?case=composer-action&goal");
+ const surface = page.locator(".thread-composer-surface");
+ await expect(surface).toBeVisible();
+ const ring = await surface.evaluate(element => {
+ const probe = document.createElement("span");
+ probe.style.color = getComputedStyle(element).getPropertyValue("--tw-ring-color");
+ document.body.append(probe);
+ const color = getComputedStyle(probe).color;
+ probe.remove();
+ return color;
+ });
+ const input = page.getByRole("textbox", { name: "Message input" });
+ await input.blur();
+ const rest = await surface.evaluate(element => getComputedStyle(element).boxShadow);
+ expect(rest).toContain(ring);
+ await input.focus();
+ const focused = await surface.evaluate(element => getComputedStyle(element).boxShadow);
+ expect(focused).toContain(ring);
+ expect(focused).toBe(rest);
+ });
+ });
+}
diff --git a/webui/src/components/startup-skeleton.css b/webui/src/components/startup-skeleton.css
index 0bb5ca64f..9f9f9e6a0 100644
--- a/webui/src/components/startup-skeleton.css
+++ b/webui/src/components/startup-skeleton.css
@@ -103,8 +103,8 @@ html.dark .startup-shell { --startup-fill: hsl(0 0% 72% / .2); --startup-surface
.startup-welcome-line { display: flex; width: 100%; max-width: 704px; height: 36.72px; align-items: center; justify-content: center; }
.startup-welcome-line .startup-block { width: 60%; height: 24px; }
.startup-composer { container: startup-composer / inline-size; width: 100%; max-width: 928px; margin: 0 auto; --composer-footer-inset: 0.75rem; --composer-action-size: 2rem; --composer-action-margin: 0px; }
-.startup-composer-surface { overflow: hidden; border-radius: 28px; background: hsl(0 0% 96.1% / .8); }
-html.dark .startup-composer-surface { background: hsl(0 0% 22%); }
+.startup-composer-surface { overflow: hidden; border-radius: 28px; background: hsl(0 0% 100%); box-shadow: inset 0 0 0 1px hsl(40 8% 90.5% / .75), 0 4px 18px -8px hsl(240 10% 16% / .12); }
+html.dark .startup-composer-surface { background: hsl(0 0% 22%); box-shadow: inset 0 0 0 1px hsl(0 0% 28% / .75), 0 4px 18px -8px hsl(240 12% 3% / .12); }
.startup-composer-input { display: flex; align-items: start; height: 78px; padding: 27px 16px 8px; }
.startup-composer-input .startup-block { width: 45%; height: 14px; margin-top: 5px; }
.startup-composer-footer { display: flex; align-items: center; gap: 6px; padding: 0 12px 14px; }
diff --git a/webui/src/components/thread/ThreadComposer.tsx b/webui/src/components/thread/ThreadComposer.tsx
index b80d92e4b..3322ae865 100644
--- a/webui/src/components/thread/ThreadComposer.tsx
+++ b/webui/src/components/thread/ThreadComposer.tsx
@@ -2641,11 +2641,11 @@ export function ThreadComposer({
data-compact={compactIdle || undefined}
style={paletteBeside ? { maxHeight: slashPaletteLayout.maxHeight, overflowY: "auto" } : undefined}
className={cn(
- "thread-composer-surface group/composer relative mx-auto flex w-full flex-col overflow-visible transition-all duration-200",
+ "thread-composer-surface group/composer relative mx-auto flex w-full flex-col overflow-visible bg-card",
paletteBeside && "col-start-1 row-start-1",
isHero
- ? "max-w-[var(--composer-content-width,58rem)] rounded-prominent bg-muted/80 focus-within:bg-muted dark:bg-card dark:focus-within:bg-white/[0.06]"
- : "max-w-[var(--composer-content-width,49.5rem)] rounded-panel bg-muted/80 focus-within:bg-muted dark:bg-card dark:focus-within:bg-white/[0.06]",
+ ? "max-w-[var(--composer-content-width,58rem)] rounded-prominent"
+ : "max-w-[var(--composer-content-width,49.5rem)] rounded-panel",
compactWhenIdle && "thread-composer-collapsible transition-colors motion-reduce:transition-none",
interactionDisabled && "opacity-60",
sessionDragPreview && "ring-1 ring-primary/25",
diff --git a/webui/src/components/thread/WorkspaceControls.tsx b/webui/src/components/thread/WorkspaceControls.tsx
index d35388a81..84e4c8210 100644
--- a/webui/src/components/thread/WorkspaceControls.tsx
+++ b/webui/src/components/thread/WorkspaceControls.tsx
@@ -555,7 +555,7 @@ export function WorkspaceProjectPicker({ disabled, scope, defaultScope, controls
<Dialog open={open} onOpenChange={setOpen}>
<HoverHint content={`${t("workspace.picker.switchDirectory")}\n${displayedScope?.project_path ?? ""}`}>
<DialogTrigger asChild>
- <button ref={triggerRef} onClick={event => { openedWithKeyboard.current = event.detail === 0; }} onPointerDown={() => setKeyboardInteraction(false)} onKeyDown={() => setKeyboardInteraction(true)} type="button" disabled={disabled} aria-label={t("workspace.picker.switchDirectory")} className="settings-hover thread-composer-workspace touch-target inline-flex h-7 min-w-0 max-w-full items-center gap-1.5 rounded-md px-2 text-[12px] font-medium text-muted-foreground outline-none transition-colors motion-reduce:transition-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-55">
+ <button ref={triggerRef} onClick={event => { openedWithKeyboard.current = event.detail === 0; }} onPointerDown={() => setKeyboardInteraction(false)} onKeyDown={() => setKeyboardInteraction(true)} type="button" disabled={disabled} aria-label={t("workspace.picker.switchDirectory")} className="thread-composer-workspace touch-target inline-flex h-7 min-w-0 max-w-full items-center gap-1.5 rounded-md px-2 text-[12px] font-medium text-muted-foreground outline-none transition-colors motion-reduce:transition-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-55">
<WorkspaceIcon className="h-3.5 w-3.5 shrink-0" />
<span className="min-w-0 truncate">{projectLabel}</span>
<ChevronDown className="h-3 w-3 shrink-0" aria-hidden />
diff --git a/webui/src/globals.css b/webui/src/globals.css
index e53c0fe7a..9e4807087 100644
--- a/webui/src/globals.css
+++ b/webui/src/globals.css
@@ -1167,10 +1167,27 @@
/* Composer controls adapt to their actual container, not just the viewport. */
.thread-composer-surface {
+ --composer-shadow-color: 240 10% 16%;
+ --tw-shadow: inset 0 0 0 1px hsl(var(--border) / 0.75), 0 4px 18px -8px hsl(var(--composer-shadow-color) / 0.12);
+ box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
+ transition: background-color 160ms ease-out, box-shadow 160ms ease-out, opacity 160ms ease-out;
container-name: thread-composer;
container-type: inline-size;
}
+.dark .thread-composer-surface {
+ --composer-shadow-color: 240 12% 3%;
+}
+
+@media (prefers-reduced-motion: reduce) {
+ .thread-composer-surface { transition: none; }
+}
+
+@media (forced-colors: active) {
+ .thread-composer-surface { outline: 1px solid CanvasText; }
+ .thread-composer-surface:focus-within { outline: 2px solid Highlight; }
+}
+
.thread-composer-footer-actions {
flex: 0 1 auto;
max-width: 58%;