[
https://issues.apache.org/jira/browse/CB-10376?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16048715#comment-16048715
]
ASF GitHub Bot commented on CB-10376:
-------------------------------------
Github user ccorcos commented on the issue:
https://github.com/apache/cordova-plugin-wkwebview-engine/pull/37
@SeanHub here's what I've learned so far:
- you can call `.focus()` so long as its in the same tick as a user action.
For example, you can call `.focus()` on an element synchronously in click event
handler.
- you can call `event.preventDefault()` on the mousedown event to prevent
the input from being blurred
Or if you want, you can use my fork and then`.focus()` just works!
```xml
<plugin name="cordova-plugin-wkwebview-engine"
spec="https://github.com/ccorcos/cordova-plugin-wkwebview-engine#e994874583d7e5f4ae1713643dbd8e01c60a0a03"
/>
```
> autofocus doesn't work with WKWebView engine plugin
> ---------------------------------------------------
>
> Key: CB-10376
> URL: https://issues.apache.org/jira/browse/CB-10376
> Project: Apache Cordova
> Issue Type: Bug
> Components: cordova-plugin-wkwebview-engine
> Affects Versions: 5.4.1
> Environment: Tested on iPhone 6 plus and iPhone 5S both running iOS
> 9.2
> Reporter: David Douglas
> Assignee: Shazron Abdullah
> Priority: Minor
> Labels: iOS, triaged
>
> When using WKWebView engine the iOS Soft Keyboard fails to automatically open
> when the 'autofocus' attribute is set.
> How to recreate:
> 1. Add platform and keyboard plugin
> {code}
> cordova platform add [email protected]
> cordova plugin add [email protected] --save
> {code}
> 2. Update iOS keyboard to enable focus commands in 'config.xml':
> {code}
> <preference name="KeyboardDisplayRequiresUserAction" value="false" />
> {code}
> 3. Add textarea to test with autofocus attribute.
> {code}
> <textarea placeholder="Edit text" autofocus></textarea>
> {code}
> (Note: Before adding the WKWebView engine plugin the UIWebView will
> automatically open the Soft Keyboard.)
> 4. Add the WKWebView engine plugin
> {code}
> cordova plugin add [email protected] --save
> {code}
> What happens:
> Nothing.
> What should happen:
> The soft keyboard should open automatically (the same a UIWebView)
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]