fix(desktop): keep gateway search shortcut local

This commit is contained in:
David Dudok de Wit
2026-08-18 17:31:37 +02:00
committed by Teknium
parent 6e9e12075c
commit e999df46fa
2 changed files with 9 additions and 0 deletions
@@ -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()
@@ -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()
}