capacitor-plugins icon indicating copy to clipboard operation
capacitor-plugins copied to clipboard

feat(keyboard): Animate webview on keyboard open / close

Open Aarbel opened this issue 3 years ago • 2 comments

Feature Request

Plugin

Keyboard

Description of current problem

When using KeyboardResize.Body as option, cf https://capacitorjs.com/docs/apis/keyboard#keyboardresize, the interface has a whole app glitch:

ON OPENING

  • the keyboard opens
  • then the webview height is set to a lower height, creating a content instant "pop"

ON CLOSING

  • the keyboard closes, creating an empty area (cf the red area on the gif bellow)
  • the webview height is 100%, but expands instantly as a glitch

cordova keyboard issue

Platform(s)

iOS Android

Preferred Solution

Make the webview height follow the keyboard height, or change instantly when keyboard begins to open.

Additional Context

Similar never resolved issue with Corodva: https://github.com/cjpearson/cordova-plugin-keyboard/pull/22

Aarbel avatar Apr 13 '22 09:04 Aarbel

https://spin.atomicobject.com/2014/01/08/animate-around-ios-keyboard/

Aarbel avatar Apr 13 '22 10:04 Aarbel

Sadly those are internal views of the WKWebView, not the WKWebView. When using body or ionic modes the WKWebView is not resized at all, those modes resize the app's body or the ion-app element by using javascript. Not saying it wouldn't be possible, but not like in the link you provided, it would be way more complex.

For resize native, that it's the only one resizing the WKWebView I tried animating it in the past with similar code than the one on the link you provided, but despite the WKWebView was following the animation correctly, some of its internal views would resize because of their parents resizing and also showed different visual glitches because of that.

jcesarmobile avatar Apr 21 '22 17:04 jcesarmobile

Any other options here? Really looks out of place on iOS :/

Only option it seems is to use None and add a custom animation? Native mode does also not provide an animation :(

digaus avatar Dec 16 '22 22:12 digaus