From e999df46fa20bcbec2a121ff7a066a8cbc12d291 Mon Sep 17 00:00:00 2001 From: David Dudok de Wit <5354424+dokterdok@users.noreply.github.com> Date: Tue, 18 Aug 2026 17:31:37 +0200 Subject: [PATCH] fix(desktop): keep gateway search shortcut local --- .../src/app/chat/sidebar/connection-switcher.test.tsx | 4 ++++ apps/desktop/src/app/chat/sidebar/connection-switcher.tsx | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/apps/desktop/src/app/chat/sidebar/connection-switcher.test.tsx b/apps/desktop/src/app/chat/sidebar/connection-switcher.test.tsx index 4ef8ab9ec8..7ae606241f 100644 --- a/apps/desktop/src/app/chat/sidebar/connection-switcher.test.tsx +++ b/apps/desktop/src/app/chat/sidebar/connection-switcher.test.tsx @@ -3,6 +3,7 @@ import { atom } from 'nanostores' import { afterEach, describe, expect, it, vi } from 'vitest' import type { DesktopConnectionsRegistry } from '@/global' +import { $findInPage } from '@/store/find-in-page' import { ConnectionSwitcher } from './connection-switcher' @@ -104,6 +105,7 @@ afterEach(() => { visible: true }) $pendingConnectionId.set(null) + $findInPage.set({ active: false, query: '', matchOrdinal: 0, matchCount: 0 }) }) describe('ConnectionSwitcher', () => { @@ -248,9 +250,11 @@ describe('ConnectionSwitcher', () => { fireEvent.keyDown(search, { key: 'ArrowDown' }) expect(globalThis.document.activeElement).toBe(result) + $findInPage.set({ active: true, query: '', matchOrdinal: 0, matchCount: 0 }) result.focus() fireEvent.keyDown(result, { key: 'f', metaKey: true }) expect(globalThis.document.activeElement).toBe(search) + expect($findInPage.get().active).toBe(false) fireEvent.keyDown(search, { key: 'Escape' }) expect(screen.queryByPlaceholderText('Search gateways…')).toBeNull() diff --git a/apps/desktop/src/app/chat/sidebar/connection-switcher.tsx b/apps/desktop/src/app/chat/sidebar/connection-switcher.tsx index c0b4f86141..87c81f610d 100644 --- a/apps/desktop/src/app/chat/sidebar/connection-switcher.tsx +++ b/apps/desktop/src/app/chat/sidebar/connection-switcher.tsx @@ -34,6 +34,7 @@ import { refreshConnectionsRegistry, selectConnection } from '@/store/connections' +import { closeFindBar } from '@/store/find-in-page' import { notifyError } from '@/store/notifications' export function ConnectionSwitcher({ onConnect }: { onConnect: () => void }) { @@ -160,6 +161,10 @@ export function ConnectionSwitcher({ onConnect }: { onConnect: () => void }) { if (searchable && (event.metaKey || event.ctrlKey) && event.key.toLocaleLowerCase() === 'f') { event.preventDefault() event.stopPropagation() + // The app-level keybind sees the chord at window capture before + // this portal and may open Find in page. This menu owns the chord + // while it is open, so close that surface before focusing here. + closeFindBar() searchInputRef.current?.focus() searchInputRef.current?.select() }