Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

fix(chrome): keep conversation actions clear of the work-panel toggle

Linuxdazhao159379dcc1ba
diff --git a/apps/desktop/src/components/ConversationTopbar.tsx b/apps/desktop/src/components/ConversationTopbar.tsx
index f8b217d89..11d1d5063 100644
--- a/apps/desktop/src/components/ConversationTopbar.tsx
+++ b/apps/desktop/src/components/ConversationTopbar.tsx
@@ -43,13 +43,11 @@ function isDefaultSessionTitle(title?: string | null) {
export function ConversationTopbar({
sidebarCollapsed,
- workPanelOpen,
onToggleSidebar,
onNewTask,
onOpenSearch,
}: {
sidebarCollapsed: boolean;
- workPanelOpen: boolean;
onToggleSidebar: () => void;
onNewTask: () => void;
onOpenSearch: () => void;
@@ -226,9 +224,7 @@ export function ConversationTopbar({
return (
<div
- className={`conversation-topbar${sidebarCollapsed ? " ct-collapsed" : ""}${
- workPanelOpen ? " ct-work-panel-open" : ""
- }`}
+ className={`conversation-topbar${sidebarCollapsed ? " ct-collapsed" : ""}`}
role="toolbar"
aria-label={t("nav.conversation")}
>
diff --git a/apps/desktop/src/features/app/AppShell.tsx b/apps/desktop/src/features/app/AppShell.tsx
index 4767aea0e..af1761bbd 100644
--- a/apps/desktop/src/features/app/AppShell.tsx
+++ b/apps/desktop/src/features/app/AppShell.tsx
@@ -204,7 +204,6 @@ export function AppShell() {
{page === "chat" ? (
<ConversationTopbar
sidebarCollapsed={sidebarCollapsed}
- workPanelOpen={presentedWorkPanelOpen}
onToggleSidebar={toggleSidebar}
onNewTask={() => void runMenuCommand("newTask")}
onOpenSearch={() => setSearchOpen(true)}
diff --git a/apps/desktop/src/styles/chat-shell.css b/apps/desktop/src/styles/chat-shell.css
index b0828d91b..17b54cd2a 100644
--- a/apps/desktop/src/styles/chat-shell.css
+++ b/apps/desktop/src/styles/chat-shell.css
@@ -39,6 +39,7 @@
}
.main-pane {
+ anchor-name: --main-pane;
position: relative;
display: flex;
/* MainChat is the first-priority column and must never be compressed below
diff --git a/apps/desktop/src/styles/chrome.css b/apps/desktop/src/styles/chrome.css
index 522dc8a4f..87a927da9 100644
--- a/apps/desktop/src/styles/chrome.css
+++ b/apps/desktop/src/styles/chrome.css
@@ -605,19 +605,28 @@
/* Conversation top bar (Codex/WorkBuddy-style): replaces the empty chat
* titlebar band with a real toolbar — session title and action buttons. It
- * mirrors the frameless drag semantics of the
- * old .main-titlebar: an absolute 46px band that is draggable, with the
- * interactive controls opting back into pointer events. */
+ * mirrors the frameless drag semantics of .main-titlebar, with interactive
+ * controls opting back into pointer events. */
.conversation-topbar {
- position: absolute;
- inset-inline: 0;
+ --ct-inline-padding: 12px;
+ position: fixed;
+ left: anchor(--main-pane left);
+ /* Follow the pane as it resizes, clamping the action group clear of the
+ * fixed toggle even while the dock is too narrow to contain that control. */
+ right: max(
+ anchor(--main-pane right),
+ calc(
+ var(--ds-work-panel-toggle-right) + var(--ds-work-panel-toggle-size) +
+ 8px - var(--ct-inline-padding)
+ )
+ );
top: 0;
z-index: 10;
display: flex;
height: var(--ds-toolbar-height);
align-items: center;
justify-content: space-between;
- padding: 0 12px;
+ padding: 0 var(--ct-inline-padding);
background: var(--ds-bg-primary);
/* Keep the conversation surface visually continuous with the titlebar. */
border-bottom: 0;
@@ -662,11 +671,6 @@
.conversation-topbar .ct-right {
flex: 0 0 auto;
justify-content: flex-end;
- padding-right: 36px;
-}
-
-.conversation-topbar.ct-work-panel-open .ct-right {
- padding-right: 0;
}
.conversation-topbar .ct-title-wrap {
@@ -904,7 +908,7 @@
.app-work-panel-toggle {
position: fixed;
top: 9px;
- right: var(--ds-work-panel-toggle-inset);
+ right: var(--ds-work-panel-toggle-right);
z-index: 30;
pointer-events: auto;
--window-drag-region: no-drag;
@@ -937,9 +941,9 @@
opacity: 0;
}
-:root[data-platform="win32"] .app-work-panel-toggle,
-:root[data-platform="linux"] .app-work-panel-toggle {
- right: calc(
+:root[data-platform="win32"],
+:root[data-platform="linux"] {
+ --ds-work-panel-toggle-right: calc(
var(--ds-window-controls-width) + var(--ds-work-panel-toggle-inset)
);
}
@@ -1025,19 +1029,6 @@
flex: 0 0 28px;
}
-/* Frameless Windows/Linux controls own a 120px band at the conversation pane's
- * right edge: 112px of controls plus an 8px visual buffer. */
-:root[data-platform="win32"] .conversation-topbar,
-:root[data-platform="linux"] .conversation-topbar {
- right: var(--ds-window-controls-width);
-}
-
-:root[data-platform="win32"] .conversation-topbar.ct-work-panel-open,
-:root[data-platform="linux"] .conversation-topbar.ct-work-panel-open {
- /* Window controls stay viewport-fixed over the panel, not this pane. */
- right: 0;
-}
-
.notification-center {
position: relative;
flex: 0 0 auto;
diff --git a/apps/desktop/src/styles/tokens.css b/apps/desktop/src/styles/tokens.css
index 7ea3e6457..6d5e63d47 100644
--- a/apps/desktop/src/styles/tokens.css
+++ b/apps/desktop/src/styles/tokens.css
@@ -177,6 +177,7 @@
cannot drift away from the viewport-fixed toggle. */
--ds-work-panel-toggle-size: 28px;
--ds-work-panel-toggle-inset: 12px;
+ --ds-work-panel-toggle-right: var(--ds-work-panel-toggle-inset);
/* The one gap between adjacent controls in the panel header row: the tab
strip to the action group, between `+` and maximize, and — through the
lane reserve that spends this token — between that group and the
diff --git a/apps/desktop/test/scheduled-return.test.mjs b/apps/desktop/test/scheduled-return.test.mjs
index 423eb9aa0..e82a979f9 100644
--- a/apps/desktop/test/scheduled-return.test.mjs
+++ b/apps/desktop/test/scheduled-return.test.mjs
@@ -56,7 +56,6 @@ async function renderTopbar(server, session, locale = "en") {
{ i18n },
createElement(ConversationTopbar, {
sidebarCollapsed: false,
- workPanelOpen: false,
onToggleSidebar() {},
onNewTask() {},
onOpenSearch() {},
diff --git a/apps/desktop/test/topbar-title-inline-rename.test.mjs b/apps/desktop/test/topbar-title-inline-rename.test.mjs
index 50958b9b7..4f8791598 100644
--- a/apps/desktop/test/topbar-title-inline-rename.test.mjs
+++ b/apps/desktop/test/topbar-title-inline-rename.test.mjs
@@ -41,7 +41,6 @@ async function withTopbar(work) {
{ i18n },
createElement(ConversationTopbar, {
sidebarCollapsed: false,
- workPanelOpen: false,
onToggleSidebar() {},
onNewTask() {},
onOpenSearch() {},
diff --git a/apps/desktop/test/topbar-title-rendering.test.mjs b/apps/desktop/test/topbar-title-rendering.test.mjs
index 81aa15928..21f6ae8ef 100644
--- a/apps/desktop/test/topbar-title-rendering.test.mjs
+++ b/apps/desktop/test/topbar-title-rendering.test.mjs
@@ -48,7 +48,6 @@ async function withTopbar(work) {
{ i18n },
createElement(ConversationTopbar, {
sidebarCollapsed,
- workPanelOpen: false,
onToggleSidebar() {},
onNewTask() {},
onOpenSearch() {},
diff --git a/apps/desktop/test/work-panel.test.mjs b/apps/desktop/test/work-panel.test.mjs
index 6fe6a3b65..6e62b4876 100644
--- a/apps/desktop/test/work-panel.test.mjs
+++ b/apps/desktop/test/work-panel.test.mjs
@@ -188,10 +188,6 @@ test("a viewport-fixed toggle is the sole pointer collapse control", () => {
globalStyles,
/padding-right:\s*calc\(var\(--ds-window-controls-width\)/,
);
- assert.match(
- globalStyles,
- /:root\[data-platform="win32"\] \.conversation-topbar\.ct-work-panel-open,[\s\S]*:root\[data-platform="linux"\] \.conversation-topbar\.ct-work-panel-open\s*\{[^}]*right:\s*0;/,
- );
});
test("the work panel shortcut closes the panel it opened", () => {
diff --git a/docs/spec/04-ux/08-component-spec.md b/docs/spec/04-ux/08-component-spec.md
index 519ea2d3c..eab693b0a 100644
--- a/docs/spec/04-ux/08-component-spec.md
+++ b/docs/spec/04-ux/08-component-spec.md
@@ -365,14 +365,15 @@ titles are host-owned. The editor closes if the active session changes.
- Background: bg-primary for the conversation bar and every route-owned
frameless drag band
- Border: border-subtle bottom on every route-owned titlebar surface
-- Position: absolute 46px frameless band; `-webkit-app-region: drag` with
- `no-drag` on interactive controls; macOS reserves the left 88px for traffic
- lights (only when the sidebar is collapsed), Windows/Linux reserve the right
- 120px for native window controls (112px hit targets plus an 8px visual
- buffer). The conversation titlebar also reserves the 28px work-panel toggle
- while the panel is closed. While the panel is open, that 120px band plus the
- toggle overlay the panel header instead, and the header ends its box before
- the band so the panel tab strip and `+` stay clear of the native control band.
+- The 46px frameless band uses `-webkit-app-region: drag` with `no-drag` on
+ interactive controls. macOS reserves the left 88px for traffic lights when
+ the sidebar is collapsed. Windows/Linux reserve the right 120px for native
+ window controls (112px of hit targets plus an 8px visual buffer). The
+ conversation titlebar follows the pane edges and keeps at least 8px
+ between its action group and the viewport-fixed work-panel
+ toggle, including during dock animations and on narrow windows. The open
+ panel header ends its box before the native control band so its tab strip and
+ `+` stay clear of the window controls.
In preview mode the header's left border box starts after the shell actions
plus an 8px gap, including expanded-sidebar New Task, on every platform.
The left inset is 8px except collapsed-sidebar windowed macOS (88px through
@@ -396,10 +397,8 @@ titles are host-owned. The editor closes if the active session changes.
- Shell consistency: the chat topbar, non-chat drag band, Settings drag band,
sidebar header, work-panel header, and native window-control band all use
`--ds-toolbar-height`. Windows/Linux keep the same `--ds-window-controls-width`
- for the viewport-fixed control band; when the work panel opens, that
- reservation moves from the conversation titlebar onto the panel header so the
- controls do not travel with MainPane (D357). The panel header carries it by
- ending its own box before the band — a margin, not padding — because the
+ for the viewport-fixed control band, independent of work-panel width (D357).
+ The panel header uses a margin to end its box before the band because the
native drag rectangle is the border box. The control band continues the
titlebar's `border-subtle` bottom rule and uses the same token for its
leading divider.
diff --git a/docs/spec/06-delivery/e2e/ui-shell.md b/docs/spec/06-delivery/e2e/ui-shell.md
index 8cfa519dc..3f81c4060 100644
--- a/docs/spec/06-delivery/e2e/ui-shell.md
+++ b/docs/spec/06-delivery/e2e/ui-shell.md
@@ -3575,8 +3575,12 @@ PowerShell-launched fixture; activation must not restore the native outline.
click Close with close-to-tray configured in the disposable profile. Also
enter and leave native fullscreen with the panel open. Check the three controls
with Chromium hit testing throughout, including light/dark Windows/Linux CSS.
+ At an 807×567 viewport with Windows renderer styles, sample the opening and
+ closing dock animations and hit-test both edges of each conversation action.
- **Expected:** Windows/Linux minimize, maximize/restore, and close stay visible
and hit-testable at the window edge. Native actions work with the panel open.
+ The New Task and Search buttons stay clickable across their width, with at
+ least 8px between the action group and the work-panel toggle in every frame.
Preview sidebar navigation remains clickable. On macOS no duplicate renderer
window controls appear; the native traffic-light and fullscreen contracts stay
unchanged. CSS emulation does not qualify another operating system's native UI.
diff --git a/scripts/e2e-window-controls.mjs b/scripts/e2e-window-controls.mjs
index 873bb9f65..00d7dcba5 100644
--- a/scripts/e2e-window-controls.mjs
+++ b/scripts/e2e-window-controls.mjs
@@ -115,6 +115,63 @@ async function checkControls(label) {
assert.ok(ok, label);
}
+async function checkConversationActionSpacing() {
+ const platform = await evaluate("document.documentElement.dataset.platform");
+ await send("Emulation.setDeviceMetricsOverride", {
+ width: 807, height: 567, deviceScaleFactor: 1, mobile: false,
+ });
+ await send("Emulation.setEmulatedMedia", {
+ features: [{ name: "prefers-reduced-motion", value: "no-preference" }],
+ });
+ await evaluate(`document.documentElement.dataset.platform = "win32";
+ window.__PI_TOPBAR_FRAMES__ = {};
+ document.addEventListener("animationstart", function samplePanel(event) {
+ if (!["work-panel-in", "work-panel-out"].includes(event.animationName)) return;
+ const panel = event.target;
+ if (!panel.matches(".work-panel")) return;
+ const animation = panel.getAnimations().find(a => a.animationName === event.animationName);
+ const actions = document.querySelector(".ct-actions");
+ const toggle = document.querySelector(".app-work-panel-toggle");
+ const buttons = [...actions.querySelectorAll(".ct-icon-btn")];
+ const { duration } = animation.effect.getComputedTiming();
+ const originalTime = animation.currentTime;
+ const frames = [];
+ for (let step = 0; step <= 20; step++) {
+ animation.currentTime = duration * step / 20;
+ const gap = toggle.getBoundingClientRect().left - actions.getBoundingClientRect().right;
+ const reachable = buttons.every(button => {
+ const rect = button.getBoundingClientRect();
+ const y = rect.top + rect.height / 2;
+ return [rect.left + 1, rect.right - 1].every(x =>
+ button.contains(document.elementFromPoint(x, y)));
+ });
+ frames.push({ step, gap, reachable });
+ }
+ animation.currentTime = originalTime;
+ window.__PI_TOPBAR_FRAMES__[event.animationName] = frames;
+ if (event.animationName === "work-panel-out") {
+ document.removeEventListener("animationstart", samplePanel);
+ }
+ });`);
+ try {
+ for (const direction of ["in", "out"]) {
+ const name = JSON.stringify(`work-panel-${direction}`);
+ await click(".app-work-panel-toggle", false);
+ await waitFor(() => evaluate(`!!window.__PI_TOPBAR_FRAMES__[${name}]`), `sample ${name}`);
+ const frames = await evaluate(`window.__PI_TOPBAR_FRAMES__[${name}]`);
+ const failures = frames.filter(frame => frame.gap < 8 || !frame.reachable);
+ assert.equal(failures.length, 0, `807×567 win32 ${name}: ${JSON.stringify(failures)}`);
+ await settle();
+ }
+ await waitFor(() => evaluate(`!document.querySelector(".work-panel")`), "spacing test panel closed");
+ console.log("PASS conversation actions are reachable throughout both work-panel animations (807×567 win32 CSS)");
+ } finally {
+ await send("Emulation.clearDeviceMetricsOverride");
+ await send("Emulation.setEmulatedMedia", { features: [] });
+ await evaluate(`document.documentElement.dataset.platform = ${JSON.stringify(platform)};`);
+ }
+}
+
async function checkWindowsRoundedCorners(
label,
rounded = true,
@@ -279,7 +336,8 @@ try {
await waitFor(() => evaluate(`document.querySelector('.app-work-panel-toggle')?.disabled === false`), "active session");
await settle();
await checkControls("panel closed");
- await checkWindowsRoundedCorners("normal window corner behavior");
+ await checkConversationActionSpacing();
+ await checkWindowsRoundedCorners("normal window corner behavior");
await checkNativeWindowResizes(["left-min", "bottom-min"]);
await click(".app-work-panel-toggle");
await waitFor(() => evaluate(`!!document.querySelector('.work-panel')`), "panel opened");