Skip to content

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

Python

Keep nested navigation menus in control of keyboard focus

justrach674bb4380b9e
diff --git a/apps/native/components/site/useResponsiveNavigation.tsx b/apps/native/components/site/useResponsiveNavigation.tsx
index bde42d1a..823e8a91 100644
--- a/apps/native/components/site/useResponsiveNavigation.tsx
+++ b/apps/native/components/site/useResponsiveNavigation.tsx
@@ -21,6 +21,9 @@ export function useResponsiveNavigation() {
className: styles.panel, "data-navigation-panel": true,
role: narrow ? "dialog" : undefined, "aria-label": narrow ? "Navigation" : undefined,
onToggle: (event: React.ToggleEvent<HTMLDivElement>) => {
+ // React also delivers descendant popover toggles here. They own their
+ // focus; opening an action menu must not refocus the sidebar close button.
+ if (event.target !== event.currentTarget) return;
const shown = event.newState === "open"; setOpen(shown);
if (shown) panel.current?.querySelector<HTMLButtonElement>('[aria-label="Close navigation"]')?.focus();
},
diff --git a/apps/native/electron/narrow-navigation-frontend.cjs b/apps/native/electron/narrow-navigation-frontend.cjs
index ce29011b..050686e5 100644
--- a/apps/native/electron/narrow-navigation-frontend.cjs
+++ b/apps/native/electron/narrow-navigation-frontend.cjs
@@ -20,6 +20,7 @@ async function runNarrowNavigation({win, output, click, until, report}) {
await js(`document.querySelector('#sidebar-chat-list button[data-row].bg-hover-2').parentElement.querySelector('button[aria-label^="Actions for "]').setAttribute('data-narrow-actions','true')`);
await click('[data-narrow-actions="true"]');
await until(() => js(`!!document.querySelector('button[aria-label^="Delete "]')?.checkVisibility()`), 'actual saved chat actions visible');
+ await until(() => js(`document.activeElement?.getAttribute('aria-label')?.startsWith('Archive ')`), 'nested action menu keeps keyboard focus');
await js(`new Promise(resolve=>requestAnimationFrame(()=>requestAnimationFrame(resolve)))`);
await new Promise(resolve=>setTimeout(resolve,150));
fs.writeFileSync(path.join(output,'narrow-navigation-actions.png'),(await wc.capturePage()).toPNG());