Skip to content

feat: find in page (#27) - #82

Merged
fmazzant merged 2 commits into
release/1.7.0from
feat/27-find-in-page
Dec 1, 2026
Merged

fmazzant merged 2 commits into
release/1.7.0from
feat/27-find-in-page

Conversation

@fmazzant

Copy link
Copy Markdown
Owner

Part of #27

Summary

  • New FindAsync(text, caseSensitive) (returns the match count, scrolls to the first match), FindNext(), FindPrevious(), ClearFind() and the FindResultsUpdated event (ActiveIndex from 0, -1 for none; Count).
  • Android: FindAllAsync / FindNext / ClearMatches with a FindListener; only the final count (isDoneCounting) is reported. Always case-insensitive.
  • iOS / Mac Catalyst: WKWebView find has no count, so a script in the page searches the main frame, highlights with the CSS Custom Highlight API (iOS 17.2+, selection before) and scrolls the active match into view.
  • Windows: WebView2 Find API (CoreWebView2.Find) with SuppressDefaultFindDialog; ActiveMatchIndex is 1-based and converted.
  • Find bar in the sample app; README section, Methods row and comparison table row.

Tests

  • Page script run in Jint on a fake DOM (count, case, hidden text, wrap-around, clear, fallback without highlights, escaping) and result parsing: 407 passed.
  • Library builds for android, ios, maccatalyst and windows with no warnings; sample builds on Windows.
  • Not yet tried on devices.

…nd (#27)

Search text in the page, highlight the matches and move between them.
FindAsync returns the match count and scrolls to the first match;
FindResultsUpdated reports the active match (from 0) and the count.

- Android: WebView.FindAllAsync, FindNext and ClearMatches with a
  FindListener (always case-insensitive).
- iOS / Mac Catalyst: WKWebView reports no count, so the search runs in the
  page: DOM ranges of the main frame, highlighted with the CSS Custom
  Highlight API (iOS 17.2+) or shown as the selection, scrolled into view.
- Windows: the WebView2 Find API without its find bar.
- Unit tests for the page script (in Jint on a fake DOM) and the result
  parsing; find bar in the sample app; README section.
@fmazzant fmazzant self-assigned this Nov 17, 2026
@fmazzant fmazzant added this to the 1.7.0 milestone Nov 17, 2026
@fmazzant
fmazzant merged commit 7e10c5f into release/1.7.0 Dec 1, 2026
4 checks passed
@fmazzant
fmazzant deleted the feat/27-find-in-page branch December 1, 2026 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants