Skip to content

The agent that grows with you

fix(desktop): find bar positioning, overlay guard, and keybind gate

David Metcalfe4e8e991d61e9
diff --git a/apps/desktop/src/app/hooks/use-keybinds.ts b/apps/desktop/src/app/hooks/use-keybinds.ts
index 6d8f5a430ee..7ce40d2f423 100644
--- a/apps/desktop/src/app/hooks/use-keybinds.ts
+++ b/apps/desktop/src/app/hooks/use-keybinds.ts
@@ -1,6 +1,7 @@
import { useEffect, useRef } from 'react'
-import { useNavigate } from 'react-router'
+import { useLocation, useNavigate } from 'react-router'
+import { appViewForPath, isOverlayView } from '@/app/routes'
import { closeActiveTab } from '@/app/chat/close-tab'
import { hudTargetSessionId } from '@/app/hud/handoff'
import { setTerminalTakeover } from '@/app/right-sidebar/store'
@@ -98,6 +99,7 @@ type HandlerMap = Record<string, () => void>
// mode is active (edit overlay / panel rebind) — records the pressed combo.
export function useKeybinds(deps: KeybindRuntimeDeps): void {
const navigate = useNavigate()
+ const location = useLocation()
const { resolvedMode, setMode } = useTheme()
// Keep the latest closures without re-subscribing the listener.
@@ -256,7 +258,13 @@ export function useKeybinds(deps: KeybindRuntimeDeps): void {
// the Win/Linux path where ⌘W reaches the renderer directly.
'view.closeTab': () => void closeActiveTab(id => navigate(sessionRoute(id))),
'view.reopenTab': reopenLastClosedTile,
- 'view.findInPage': openFindBar,
+ 'view.findInPage': () => {
+ // Suppress on overlay routes so it doesn't collide with overlay-specific
+ // search surfaces (e.g. Settings search bar).
+ if (!isOverlayView(appViewForPath(location.pathname))) {
+ openFindBar()
+ }
+ },
// ⌘G / ⌘⇧G are handled by the find bar's own capture-phase listener while
// it is open (so they don't collide with `view.toggleReview`). These
// registry handlers cover a user-assigned dedicated chord: stepping is a
diff --git a/apps/desktop/src/components/find-bar.test.tsx b/apps/desktop/src/components/find-bar.test.tsx
index 625aa38d06f..3d2f1484608 100644
--- a/apps/desktop/src/components/find-bar.test.tsx
+++ b/apps/desktop/src/components/find-bar.test.tsx
@@ -609,4 +609,17 @@ describe('FindBar', () => {
await waitFor(() => expect(screen.queryByRole('search')).toBeNull())
expect(bridge.stopFindInPage).not.toHaveBeenCalled()
})
+
+ it('does not render on overlay routes (settings, command center, …)', () => {
+ // Match isOverlayView: agents, command-center, cron, profiles, settings,
+ // starmap, webhooks. Test with the most commonly hit one.
+ openFindBar()
+ renderFindBar('/settings')
+
+ expect(screen.queryByRole('search')).toBeNull()
+ // The store still has active=true but the component guard suppresses
+ // rendering — a harmless state ghost that the next pathname-change
+ // cleanup will drain via closeFindBar.
+ expect($findInPage.get().active).toBe(true)
+ })
})
diff --git a/apps/desktop/src/components/find-bar.tsx b/apps/desktop/src/components/find-bar.tsx
index 40888049e51..75a284ba0ed 100644
--- a/apps/desktop/src/components/find-bar.tsx
+++ b/apps/desktop/src/components/find-bar.tsx
@@ -2,6 +2,7 @@ import { useStore } from '@nanostores/react'
import { useEffect, useRef, useState } from 'react'
import { useLocation } from 'react-router'
+import { appViewForPath, isOverlayView } from '@/app/routes'
import { Tip } from '@/components/ui/tooltip'
import { useI18n } from '@/i18n'
import { findBarKeyAction, formatMatchLabel } from '@/lib/find-in-page'
@@ -121,7 +122,7 @@ export function FindBar() {
return () => window.removeEventListener('keydown', onKeyDown, { capture: true })
}, [active])
- if (!active) {
+ if (!active || isOverlayView(appViewForPath(pathname))) {
return null
}