Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IOS 11.1.1 WKWebView ShrinksView shrinks view twice on first focus #64

Closed
Sbopf opened this issue Nov 13, 2017 · 9 comments
Closed

IOS 11.1.1 WKWebView ShrinksView shrinks view twice on first focus #64

Sbopf opened this issue Nov 13, 2017 · 9 comments

Comments

@Sbopf
Copy link

Sbopf commented Nov 13, 2017

It's working on older versions of ios but in the latest (11.1.1 on iPhone 8) it seems to set the window height to a very small number the first time you focus an input.

I suspect from what i have observed that it is subtracting the keyboard height twice from the webview.

If you have 2 inputs and you focus one, then focus the other the correct webview height is applied. But the first time you focus an input from an unfocussed state the window shrinks too much.

@Pigsnuck
Copy link

I can confirm this behaviour on iOS 11.1.1 on iPhone 7 Plus.

@edgarciametro
Copy link

Can confirm here on iPhone 7. This is pretty critical, apps are broken because of it.

@cjpearson
Copy link
Owner

cjpearson commented Nov 15, 2017

Do any of you have sample code that displays this behavior? I've tried reproducing it on an 11.1.1 5S Device and 11.1 iPhone 7 Sim.

@Sbopf
Copy link
Author

Sbopf commented Nov 15, 2017

I'm using the following:

IPhone 8, IOS 11.1.1 (real device)

Cordova version 7.1.0 IOS platform version 4.5.2 cordova-plugin-wkwebview-engine 1.1.3 cordova-plugin-keyboard 1.1.4 (also tried 1.1.5 but got same behaviour)

As far as I can tell i haven't done anything special to a project with the above setup.

Attached is a video of the behavour. The blue highlighting is me focussing the window with safari dev tools to show what the window height is at each point in the demo. Also there is a regular input as well as my customised ones to prove that the input's javascript / html is not effecting it.

You can see where the window gets cut off on focussing inputs.
And you can see if i am already focussing an input, and focus another it fixes itself. But when focussing an input from an unfocussed state the window height shrinks drastically.

MKOQ2141.zip

Sorry I don't have a sample project available for public inspection.

@edgarciametro
Copy link

Don’t really have a project I can share but I can tell you it started after iOS 11.1.1 because apps installed prior to the update, and apps being installed now are both showing the same behavior. I have disabled the shrink view for now as fix.

@cjpearson
Copy link
Owner

Thanks for the video repro. It looks like WKWebView is the key here. Once I add that plugin, I can reproduce on both the device and simulator.

@cjpearson
Copy link
Owner

This appears to be caused by something in the WKWebView keyboard event listener, but I'm not sure exactly what. We already remove those handlers for iOS 8-10, so I think the easiest solution is to remove them for 11 as well. There's actually already a commit doing this to fix a different bug (#55) but it hasn't been released to npm yet. Does installing the latest from github fix the issue for you?

@Sbopf
Copy link
Author

Sbopf commented Nov 15, 2017

Hey I downloaded the master branch and replaced the CDVKeyboard.m file in my project with the new version and my IPhone 8 ios 11.1.1 is now functioning correctly with shrink view. My old device on ios 10 is still working perfectly aswell so I would say this is now resolved for me.

Thank you for the help!

@cjpearson
Copy link
Owner

Thanks for the confirmation. I've pushed 1.2.0 to npm, so if you remove and re-add the plugin you should get the update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants