NEW227364
iOS WKWebView findString not selecting and scrolling
https://bugs.webkit.org/show_bug.cgi?id=227364
Summary iOS WKWebView findString not selecting and scrolling
zero.griffin
Reported 2021-06-24 11:05:08 PDT
Since iOS 14 WebKit supports findString, but there is no documentation whatsoever yet. However on the WWDC Sessions Discover WKWebView enhancements they mention that is a basic functionality for "Find on Page", where you can find a string and the WebView will select it and scroll to center it. It seems very easy to use and to be finding the string as I get a result of matchFound true, but there is no selection and there is no scrolling. Maybe I'm missing something? This is the code I have tried: let webView = WKWebView() // ... // after loading a website with the desired string on it. // ... webView.find("hello world") { result in print(result.matchFound) // true }
Attachments
Wenson Hsieh
Comment 1 2021-06-24 12:48:47 PDT
FWIW, the documentation does suggest that the matching range ought to be selected and scrolled into view: ``` /* @abstract Searches the page contents for the given string. @param string The string to search for. @param configuration A set of options configuring the search. @param completionHandler A block to invoke when the search completes. @discussion If the WKFindConfiguration is nil, all of the default WKFindConfiguration values will be used. A match found by the search is selected and the page is scrolled to reveal the selection. The completion handler is called after the search completes. */ - (void)findString:(NSString *)string withConfiguration:(nullable WKFindConfiguration *)configuration completionHandler:(void (^)(WKFindResult *result))completionHandler NS_REFINED_FOR_SWIFT WK_API_AVAILABLE(macos(11.0), ios(14.0)); ```
Radar WebKit Bug Importer
Comment 2 2021-07-01 11:06:18 PDT
Note You need to log in before you can comment on or make changes to this bug.