Skip to content

armgit / orca

Public Imported from GitHub
0

Orca is the place for working with a fleet of agents (e.g. Grok Bot, Claude Code). Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

fix(browser): close client-hosted Find on full navigation (#35692)

OrcaWinc5d74cec5ffa
diff --git a/src/renderer/src/components/browser-pane/ClientHostedBrowserPagePane.chrome-parity.test.tsx b/src/renderer/src/components/browser-pane/ClientHostedBrowserPagePane.chrome-parity.test.tsx
index d6219b7c9e0..8315586190c 100644
--- a/src/renderer/src/components/browser-pane/ClientHostedBrowserPagePane.chrome-parity.test.tsx
+++ b/src/renderer/src/components/browser-pane/ClientHostedBrowserPagePane.chrome-parity.test.tsx
@@ -194,6 +194,50 @@ describe('ClientHostedBrowserPagePane chrome parity', () => {
expect(screen.getByPlaceholderText('Find in page...')).not.toBeNull()
})
+ it('closes Find on a full navigation', () => {
+ const { webview } = renderPane()
+ vi.mocked(webview.findInPage).mockReturnValueOnce(1)
+
+ act(() => findRequests.emit(undefined))
+ fireEvent.change(screen.getByPlaceholderText('Find in page...'), {
+ target: { value: 'needle' }
+ })
+ fireEvent.keyDown(screen.getByPlaceholderText('Find in page...'), { key: 'Enter' })
+ act(() =>
+ webview.dispatchEvent(
+ Object.assign(new Event('found-in-page'), {
+ result: { requestId: 1, activeMatchOrdinal: 1, matches: 3, finalUpdate: true }
+ })
+ )
+ )
+ expect(screen.getByText('1 of 3')).not.toBeNull()
+
+ act(() =>
+ webview.dispatchEvent(
+ Object.assign(new Event('did-navigate'), { url: 'https://example.internal/next' })
+ )
+ )
+
+ expect(screen.queryByPlaceholderText('Find in page...')).toBeNull()
+ expect(screen.queryByText('1 of 3')).toBeNull()
+ })
+
+ it('keeps Find open for an in-page navigation', () => {
+ const { webview } = renderPane()
+ act(() => findRequests.emit(undefined))
+
+ act(() =>
+ webview.dispatchEvent(
+ Object.assign(new Event('did-navigate-in-page'), {
+ url: 'https://example.internal/app#section',
+ isMainFrame: true
+ })
+ )
+ )
+
+ expect(screen.getByPlaceholderText('Find in page...')).not.toBeNull()
+ })
+
it('reloads and hard-reloads the retained guest from the forwarded chords', () => {
const { webview } = renderPane()
diff --git a/src/renderer/src/components/browser-pane/ClientHostedBrowserPagePane.tsx b/src/renderer/src/components/browser-pane/ClientHostedBrowserPagePane.tsx
index bd59eec0db1..8d196c26d9f 100644
--- a/src/renderer/src/components/browser-pane/ClientHostedBrowserPagePane.tsx
+++ b/src/renderer/src/components/browser-pane/ClientHostedBrowserPagePane.tsx
@@ -215,6 +215,7 @@ export function ClientHostedBrowserPagePane({
// A commit is a successful load; did-stop-loading must preserve the preceding did-fail-load overlay.
if (event?.type === 'did-navigate') {
activeLoadFailureRef.current = null
+ setFindOpen(false)
}
const activeLoadFailure = activeLoadFailureRef.current
// URL writes clear certificate challenges, so preserve them while a failure stands.