Bug 229600

Summary: WKWebView: cannot become first responder using focus() in JavaScript or native becomeFirstResponder() method
Product: WebKit Reporter: Daohan Chong <dh.chong>
Component: HTML EditingAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: ggaren, simon.fraser, thorton, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar
Version: Safari 14   
Hardware: iPhone / iPad   
OS: iOS 13   

Description Daohan Chong 2021-08-26 21:45:35 PDT
For example, if we'd like to build a web based text editor, we'd like to automatically focus on the text input area in `UIViewController.viewDidAppear`.

However, we cannot build behavior like this using public API. For example, all these won't work:

- Calling `htmlElement.focus()` does nothing.
- `WKWebView.becomeFirstResponder()`

The community is trying to explore how to work around this missing feature: https://stackoverflow.com/questions/32449870/programmatically-focus-on-a-form-in-a-webview-wkwebview/48623286#48623286

This can be reproduced on iOS 13 to iOS 15 beta.
Comment 1 Radar WebKit Bug Importer 2021-09-02 21:46:18 PDT