Since WKWebView is now built into the compile process there is no separate plugin which, frankly, boggles my mind as plugins was the fix for not having to do so many cli releases (or that was the explanation given back in the 1.8.x days).
So that leaves us with two keyboard problems:
- The input focus problem which is common.
- The problem ov the viewport being shrunk when the keyboard is displayed and the viewport not resized when the keyboard is dismissed.
To my understanding the cordova team “swears” both these problems are fixed in the latest version but clearly they’re not.
The fix for the shrinking viewport is this plugin which does indeed solve the problem but comes with a disclaimer that your app may be rejected because the plugin does the very thing your comments about the PR reference.
<plugin name="cordova-plugin-wkkeyboardfix" />
From my experience, the issue of the focus is because you can’t (iOS won’t allow) you to set the focus on a page that isn’t in view. The reason is very related to the shrinking viewport problem. When you set the focus, iOS pops up the keyboard. Doing this while the page is in transition (beforeshow) results in a bunch of wonky stuff.
What I did to solve this was to use a setTimeout to give the page a chance to transition in. I used the timeout method because the framework I use doesn’t have an aftershow event.
What I’d do in your case is to hook onto the aftershow event at which time the page should be fully rendered and then set the focus. If that doesn’t work, try using a setTimeout inside the aftershow event with 125ms value and see if that works.