Skip to content

fix(desktop): keep the find bar's query field out of native find-in-page results - #86843

Merged
teknium1 merged 1 commit into
mainfrom
salvage/73467-findbar-native-results
Aug 15, 2026
Merged

teknium1 merged 1 commit into
mainfrom
salvage/73467-findbar-native-results

Conversation

@teknium1

Copy link
Copy Markdown
Collaborator

Excludes the find bar's own query field from Electron's native webContents.findInPage results by making the input transiently inert while Chromium indexes the page, so typing "needle" no longer counts the query echo as a match.

Salvaged from #73467 — all credit to @zyz619963502zyz (cherry-picked to preserve authorship). Fixes #73374.

What changed

  • Renderer (find-bar.tsx): when the 200ms debounce fires, the input is made inert (the HTML inert contract removes it from find-in-page indexing), and restored — with focus and caret position — once the IPC reply confirms Chromium has started returning results for this request. A request counter (nativeSearchRequestRef) makes the restore request-scoped so a stale reply can't un-inert the field early. The input also becomes a truthful type="search" (tests now query role=searchbox) with autoComplete="off".
  • Main process (find-in-page.ts / main.ts): new performFindAfterIndexingStarted() starts the find and resolves only after the first found-in-page event carrying the matching requestId (or on destroyed). The hermes:find-in-page IPC handler awaits it, so the renderer's promise resolution is the "indexing has started" acknowledgment.
  • Store (find-in-page.ts): setFindQuery is now async and awaits the bridge call so the renderer can sequence the inert/restore cycle on it.
  • Tests: 2 new unit tests for performFindAfterIndexingStarted (fake webContents), a renderer test asserting the inert cycle + focus/selection restoration, and a real-Electron fixture (electron/find-in-page-native-fixture/ + find-in-page-native.test.mjs, run via npm run test:find-in-page-native) proving against a live BrowserWindow that a visible search input is counted (control: 2 matches), that the transient inert boundary excludes it (1 match), and that the accessibility tree still exposes a truthful named searchbox afterwards.

An earlier revision of #73467 used type="password" + role="searchbox", which the sweeper review correctly rejected as non-conforming ARIA; the contributor reworked it to this inert approach, which keeps valid, truthful search semantics — the head commit salvaged here contains only the reworked version.

Salvage notes vs. current main

  • The PR's 34px titlebar-fallback positioning change is already on main (fix(desktop): FindBar no longer overlaps native window controls #86746, 5ed4506f42) — the cherry-pick conflict was resolved keeping main's fuller comment; the surviving diff is purely the native-results exclusion.
  • The new Electron runtime fixture test needs a display (it SIGSEGVs headless without X/Xvfb), so it is not wired into CI — it's an opt-in script (test:find-in-page-native) for local/desktop verification, matching the contributor's own Windows run.

Validation

  • npx vitest run src/components/find-bar.test.tsx — 49 passed
  • npx vitest run electron/find-in-page.test.ts — 22 passed
  • npm run check:lint (tsc ×3 tsconfigs + eslint) — 0 errors
  • npm run test:find-in-page-native — not runnable in this headless environment (no $DISPLAY); contributor reports it green on a real BrowserWindow (RED 2 matches → GREEN 1 match)
  • python3 scripts/audit_pr_attribution.py --fix — all contributor emails mapped
  • Base gate: 0 commits behind origin/main

Infographic

PR infographic

@teknium1
teknium1 requested a review from a team August 15, 2026 08:57
@github-actions

github-actions Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

૮ >ﻌ< ა ci review

ran on 6383c80 — fix(desktop): keep find bar out of its results

⚠️ Warnings

OSV vulnerability scan · View job

5 known vulnerabilities found in pinned dependencies.

How to fix:

Review the findings in the Security tab. Update the affected dependencies if a patched version is available.


debug info

CI timings

CI timings · View report · View job

Wall time 5m42s vs 8m28s (-32.7%). 11 job(s) slower, 5 faster, 2 unchanged.

  • OSV scan / Scan lockfiles / osv-scan: +32.0s
  • JS & TS checks / ui-tui/packages/hermes-ink / check: +21.0s
  • JS & TS checks / ui-tui / check: +20.0s
  • JS & TS checks / apps/desktop / check:lint: +14.0s
  • JS & TS checks / apps/desktop / check:test:ui:shard-2of3: +13.0s

@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/desktop Electron desktop app (apps/desktop/*) labels Aug 15, 2026
@teknium1
teknium1 force-pushed the salvage/73467-findbar-native-results branch from 38ee697 to 6383c80 Compare August 15, 2026 09:13
@teknium1
teknium1 merged commit ca8a47e into main Aug 15, 2026
38 checks passed
@teknium1
teknium1 deleted the salvage/73467-findbar-native-results branch August 15, 2026 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/desktop Electron desktop app (apps/desktop/*) P3 Low — cosmetic, nice to have type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Desktop: search input overlaps UI panel + self-counts search term

3 participants