Skip to content

Commit b826390

Browse files
committed
fix(control-ui): keep Ask OpenClaw reachable while the nav is collapsed
Address the ClawSweeper P1: desktop collapse hides the sidebar entirely (display:none, no rail), which would have removed the toggle's only persistent surface. The lobster now joins the chrome strip exactly while the nav is collapsed — the footer stays its home — and the strip's collapsed width reserves four controls for that state. Regression covers collapsed-present/expanded-absent/read-scope-absent.
1 parent c068913 commit b826390

3 files changed

Lines changed: 28 additions & 1 deletion

File tree

‎ui/src/app/app-host.dock-suppression.test.ts‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,5 +218,15 @@ describe("OpenClaw shell dock suppression", () => {
218218
context.sessions.state.result = null;
219219
renderLit(shell.render(), container);
220220
expect(desktopAvailable()).toBe(true);
221+
222+
// Collapsed-nav fallback: the Ask OpenClaw toggle joins the chrome strip
223+
// only while the sidebar (its footer home) is hidden, and stays admin-gated.
224+
expect(container.querySelector(".shell-chrome-controls__custodian")).toBeNull();
225+
context.navigation.snapshot.navCollapsed = true;
226+
renderLit(shell.render(), container);
227+
expect(container.querySelector(".shell-chrome-controls__custodian")).not.toBeNull();
228+
context.gateway.snapshot.hello!.auth = { role: "operator", scopes: ["operator.read"] };
229+
renderLit(shell.render(), container);
230+
expect(container.querySelector(".shell-chrome-controls__custodian")).toBeNull();
221231
});
222232
});

‎ui/src/app/app-shell-view.ts‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import type {
77
SidebarWorkboardSnapshot,
88
} from "../components/app-sidebar-workboard.ts";
99
import { icons } from "../components/icons.ts";
10+
import { CUSTODIAN_PANEL_TOGGLE_EVENT } from "../components/panel-toggle-contract.ts";
1011
import { renderSettingsSidebar } from "../components/settings-sidebar.ts";
1112
import type { ThemeModeChangeDetail } from "../components/theme-mode-toggle.ts";
1213
import { t } from "../i18n/index.ts";
@@ -548,6 +549,19 @@ export function renderApplicationShell(host: ShellViewHost) {
548549
${icons.search}
549550
</button>
550551
</openclaw-tooltip>
552+
${navCollapsed && custodianPanelAvailable
553+
? html`<openclaw-tooltip .content=${t("nav.askOpenClaw")}>
554+
<button
555+
type="button"
556+
class="shell-chrome-controls__button shell-chrome-controls__custodian"
557+
aria-label=${t("nav.askOpenClaw")}
558+
@click=${() =>
559+
window.dispatchEvent(new CustomEvent(CUSTODIAN_PANEL_TOGGLE_EVENT))}
560+
>
561+
${icons.lobster}
562+
</button>
563+
</openclaw-tooltip>`
564+
: nothing}
551565
</div>
552566
`
553567
: nothing}

‎ui/src/styles/layout.css‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,12 @@
1010
--shell-chrome-controls-inset: 10px;
1111
--shell-chrome-control-size: 32px;
1212
--shell-chrome-controls-gap: 4px;
13+
/* Four controls: the admin-gated Ask OpenClaw fallback joins the strip only
14+
while the nav is collapsed, which is exactly when this width applies. */
1315
--shell-chrome-controls-collapsed-width: calc(
1416
var(--shell-chrome-control-size) + var(--shell-chrome-control-size) +
15-
var(--shell-chrome-control-size) + var(--shell-chrome-controls-gap) +
17+
var(--shell-chrome-control-size) + var(--shell-chrome-control-size) +
18+
var(--shell-chrome-controls-gap) + var(--shell-chrome-controls-gap) +
1619
var(--shell-chrome-controls-gap)
1720
);
1821
--shell-chrome-safe-area-left: calc(

0 commit comments

Comments
 (0)