-
Notifications
You must be signed in to change notification settings - Fork 1k
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 12 App Touch-Areas are offset after keyboard is hidden #814
Comments
Are you using Xcode 10, right? Can you try with Xcode 9 and see if you can reproduce there? But testing directly from Xcode 9 in iOS 12 devices is not possible as it fails to install, you'll have to export the ipa and install it manually |
You are right, does not happen with Xcode 9 / iOS 11. |
I meant, can you test this in Xcode 9 but on iOS 12 device? |
Just tried it, built with Xcode 9 and run on iOS 12 device works fine. |
I am also seeing this issue when using keyboard which causes input to scroll into view (may be through using keyboard arrows) then closing the keyboard, the buttons in my toolbar cannot be clicked. When you press them nothing happens. This issue is consistently reproducible and makes the app unusable. Inline with this issue, it does not seem to affect my app when running on iOS 11. Not super sure the cause of this issue, many issues have been raised across other projects, but it is also effecting capacitor apps. Potential test project https://github.com/dpogue/WKScrollTest |
We just filed the same bug against ionic 4, but was told it was probably a capacitor issue as far as ionic is concerned, so rather than open another issue, I'll paste it here: Ionic Info
Describe the Bug Steps to Reproduce
Related Code Additional Context |
I did some testing on multiple ios/emulators iPhone 8 Plus iOS 11 -> no view shits everything is ok |
Anyone has the fix of this problem? |
Can confirm that this issue exists in Cordova on iOS 12 as well apache/cordova-ios#417 |
Hi all, i am facing that issue run on IOS 12 that was built with Xcode 10 (if you build with XCode 9, the issue don't appear). The root cause of issue is WKScrollview in WKWebview will be changed automatically content offset fit with height of keyboard in case keyboard is showed, but it didn't reset in case keyboard is hidden. That is my solution to fixed it, hope it help for you.
|
@jcesarmobile Regarding this comment: #814 (comment) Is it not possible to set the SDK that XCode uses to build instead of having to install another version of XCode? |
Here it says you can but it present a few problems |
OK, thanks for the feedback! Looks like it would be more of a headache to do this than installing an additional version of XCode. |
any solution? |
This was merged in corodva ionic webview Anyone knows how to integrate it with capacitor (I am not using cordova plugin)? |
this is exactly the problem I am having - any use of the keyboard completely messes up the webview container and shifts it all up |
this happens on the IOS device itself and has completely halted any chances of pushing out to customers |
Hello, we are experiencing the same bug on iOS 12. When the keyboard closes, the webview keeps a "padding" from the bottom like if the keyboard was still visible. |
I adapted the solution from #814 (comment) to Swift and used it in the
This fixes my issues. |
That last solution works fine ! That problem can be fixed by disabling the release optimizations : |
As well as the keyboard input issues, I appear to be having essentially the same problem with the UI that pops up to handle selection of choices in a form select element. |
I had the same issue. My fix was to add the following code to the index.html: window.addEventListener('keyboardWillHide', () => {
window.scrollTo(0,0);
document.body.scrollTop = 0;
}); |
Can confirm this works as a workaround, even if you update xcode to 10.1. Thank you @NudelSieb !! |
And UIScrollViewDelegate
Worked |
FWIW, I implemented @NudelSieb's solution above, with a couple caveats.
const scrollToTopFn = () => {
if (window.Keyboard && !window.Keyboard.isVisible) {
window.scrollTo(0,0);
window.document.body.scrollTop = 0;
}
};
window.addEventListener('keyboardDidHide', () => {
window.setTimeout(scrollToTopFn, 100);
}); |
Finally got it to work.. I had to piece together this file here: fix keyboard displacement bug in iOS 12 WKWebView from @hghammoud A straight copy didn't work, but taking each part and adding it to my CDVWKWebViewEngine.m file worked for me. I'll post my file if anyone needs it. Here's my setup: Cordova: System: |
<input (blur)="scrollToTop()">
scrollToTop()
{
window.scrollTo(0,0);
}
|
期待有人能真正解决 |
I can still reproduce this with iOS 11.4.1 and xcode 9.4.1 |
I think this should be fixed in next release, I made a few keyboard changes that combined seem to fix it. @daniellizik what you comment should be a different issue as this only affects iOS 12 when using Xcode 10, not iOS 11 despite the Xcode version, and doesn't affect any iOS version when using Xcode 9. |
@jcesarmobile Confirming that even with the latest release (4.0.2) the issue is not fixed. |
Not sure what 4.0.2 you mean, but I’m talking about next capacitor release (1.0.0 beta 18, still not released) |
@jcesarmobile Is the fix that you've made is in a branch that we can test? |
Beta 18 is out, can you test with it? |
@jcesarmobile https://drive.google.com/file/d/11Msg2lSiW1UoN-si6nL1QxLS93shBu9h/view None of these occur on my Android-devices. |
@jcesarmobile it is working great on my iPhone 7 test device running iOS 12! It seems to have completely fixed the bug introduced by Apple's webview in iOS 12. Thanks for this update. |
when the given page loads, if it is ios etc etc, I attach a listener reset scroll is running on a short timeout and checks if the innerheight and height is the same, if se, it resets the scroll. This results in the scroll only being reset once the keyboard is removed from screen, rather than everytime the focus is changed.
|
I can't reproduce since beta 18 and calvinckho also confirmed that it's working fine for him, so I'm going to close. |
Steps to reproduce:
What happens:
-> The UI shifts down, but touchareas of UI-Elements are still offset. Causing always touching the wrong button
Tested with iPhone X and iPhone 8 Simulator on iOS 11 and iOS 12.
Only happens on iOS 12 (both Simulators)
When you take a look at the View Hierarchy it seems, some Subviews of the WebView are still offset.
Screenshot of Hierarchy attached.
The text was updated successfully, but these errors were encountered: