Skip to content

graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs

Python

fix(gui): three dead ends found by driving the UI, not reading it

Rach Pradhana45c1f640274
diff --git a/gui/src/app/App.tsx b/gui/src/app/App.tsx
index 60fe69f3..6a2008d8 100644
--- a/gui/src/app/App.tsx
+++ b/gui/src/app/App.tsx
@@ -81,7 +81,6 @@ function AppSidebarControl({
isSidebarVisible,
isSettingsViewOpen,
onExitSettings,
- onToggleDesktopSidebar,
}: AppSidebarControlProps) {
const { toggleSidebar } = useSidebar();
const controlPositionClass = isFullscreen ? "left-3" : "left-20";
@@ -107,10 +106,7 @@ function AppSidebarControl({
size="icon-sm"
aria-label={isSidebarVisible ? "Hide sidebar" : "Show sidebar"}
className={`absolute top-2 z-20 ${controlPositionClass}`}
- onClick={() => {
- toggleSidebar();
- onToggleDesktopSidebar();
- }}
+ onClick={toggleSidebar}
>
<PanelLeftIcon strokeWidth={2} className="size-3.5" />
<span className="sr-only">
@@ -262,9 +258,27 @@ function AppShell() {
);
}
+ // Sidebar visibility has exactly one owner: this state. SidebarProvider is
+ // controlled by it, so ⌘B (whose handler lives inside SidebarProvider) and
+ // the toggle button both run this. They used to be two separate states that
+ // only the button's onClick kept in sync, which meant ⌘B flipped the
+ // provider's half, left the resizable panel alone, and looked like a dead
+ // shortcut — while still calling preventDefault and eating the keystroke.
+ function handleSidebarOpenChange(nextIsVisible: boolean) {
+ runSidebarToggleAnimation();
+ setIsDesktopSidebarVisible(nextIsVisible);
+ if (!nextIsVisible) {
+ setIsSettingsViewOpen(false);
+ }
+ }
+
return (
<TooltipProvider>
- <SidebarProvider className="min-h-screen bg-background">
+ <SidebarProvider
+ className="min-h-screen bg-background"
+ open={isDesktopSidebarVisible}
+ onOpenChange={handleSidebarOpenChange}
+ >
<main className="app-shell relative flex h-screen w-full overflow-hidden bg-sidebar">
<AppThemeToggle
isDarkTheme={isDarkTheme}
@@ -277,16 +291,6 @@ function AppShell() {
onExitSettings={() => {
setIsSettingsViewOpen(false);
}}
- onToggleDesktopSidebar={() => {
- runSidebarToggleAnimation();
- setIsDesktopSidebarVisible((current) => {
- const nextIsVisible = !current;
- if (!nextIsVisible) {
- setIsSettingsViewOpen(false);
- }
- return nextIsVisible;
- });
- }}
/>
<NewChatTrigger>
{({ isBusy, openNewChat }) => {
diff --git a/gui/src/app/types/app.ts b/gui/src/app/types/app.ts
index ca4832b8..60577498 100644
--- a/gui/src/app/types/app.ts
+++ b/gui/src/app/types/app.ts
@@ -7,7 +7,6 @@ export interface AppSidebarControlProps {
isSidebarVisible: boolean;
isSettingsViewOpen: boolean;
onExitSettings: () => void;
- onToggleDesktopSidebar: () => void;
}
export interface SessionProviderProps {
diff --git a/gui/src/components/PromptControlBar.tsx b/gui/src/components/PromptControlBar.tsx
index 22b6ab2b..13b8f496 100644
--- a/gui/src/components/PromptControlBar.tsx
+++ b/gui/src/components/PromptControlBar.tsx
@@ -112,7 +112,21 @@ export function PromptControlBar({
className="h-8 bg-popover dark:bg-popover"
autoFocus
onChange={(event) => onSearchQueryChange(event.target.value)}
- onKeyDown={(event) => event.stopPropagation()}
+ onKeyDown={(event) => {
+ // Letters must reach this input instead of the menu's
+ // typeahead — but swallowing *every* key also ate Escape
+ // and the arrows, so once the search box took focus (it
+ // autoFocuses) the picker could not be closed or navigated
+ // from the keyboard at all.
+ if (
+ event.key === "Escape" ||
+ event.key === "ArrowDown" ||
+ event.key === "ArrowUp"
+ ) {
+ return;
+ }
+ event.stopPropagation();
+ }}
/>
</div>
<DropdownMenuGroup>
diff --git a/gui/src/components/new-chat-screen/NewChatScreen.tsx b/gui/src/components/new-chat-screen/NewChatScreen.tsx
index 577e5eae..ca82ff2c 100644
--- a/gui/src/components/new-chat-screen/NewChatScreen.tsx
+++ b/gui/src/components/new-chat-screen/NewChatScreen.tsx
@@ -221,12 +221,12 @@ function NewChatScreenContent({
}
return (
- <div className="flex min-h-0 flex-1 flex-col overflow-hidden px-6 py-8">
+ <div className="flex min-h-0 flex-1 flex-col overflow-y-auto px-6 py-8">
<div
className={
hasCommandResults
? "mx-auto flex min-h-0 w-full max-w-4xl flex-1 flex-col gap-5"
- : "mx-auto flex w-full max-w-4xl flex-1 flex-col items-center justify-center gap-6"
+ : "mx-auto flex w-full max-w-4xl flex-1 flex-col items-center justify-center-safe gap-6"
}
>
{!hasCommandResults ? (