fix(desktop): keep the find bar's query field out of native find-in-page results - #86843
Merged
Merged
Conversation
Contributor
૮ >ﻌ< ა ci reviewran on 6383c80 — fix(desktop): keep find bar out of its results
|
teknium1
force-pushed
the
salvage/73467-findbar-native-results
branch
from
August 15, 2026 09:13
38ee697 to
6383c80
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Excludes the find bar's own query field from Electron's native
webContents.findInPageresults by making the input transientlyinertwhile 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
find-bar.tsx): when the 200ms debounce fires, the input is madeinert(the HTMLinertcontract 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 truthfultype="search"(tests now queryrole=searchbox) withautoComplete="off".find-in-page.ts/main.ts): newperformFindAfterIndexingStarted()starts the find and resolves only after the firstfound-in-pageevent carrying the matchingrequestId(or ondestroyed). Thehermes:find-in-pageIPC handler awaits it, so the renderer's promise resolution is the "indexing has started" acknowledgment.find-in-page.ts):setFindQueryis now async and awaits the bridge call so the renderer can sequence the inert/restore cycle on it.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 vianpm run test:find-in-page-native) proving against a liveBrowserWindowthat 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 namedsearchboxafterwards.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 thisinertapproach, which keeps valid, truthful search semantics — the head commit salvaged here contains only the reworked version.Salvage notes vs. current main
5ed4506f42) — the cherry-pick conflict was resolved keeping main's fuller comment; the surviving diff is purely the native-results exclusion.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 passednpx vitest run electron/find-in-page.test.ts— 22 passednpm run check:lint(tsc ×3 tsconfigs + eslint) — 0 errorsnpm run test:find-in-page-native— not runnable in this headless environment (no$DISPLAY); contributor reports it green on a realBrowserWindow(RED 2 matches → GREEN 1 match)python3 scripts/audit_pr_attribution.py --fix— all contributor emails mappedorigin/mainInfographic