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

(Fixed) Snaps to top of screen on blur on iOS 12+ #399

Closed
YCMitch opened this issue Jul 18, 2019 · 11 comments
Closed

(Fixed) Snaps to top of screen on blur on iOS 12+ #399

YCMitch opened this issue Jul 18, 2019 · 11 comments

Comments

@YCMitch
Copy link

YCMitch commented Jul 18, 2019

After days of screwing around with other plugins/settings/native code/angry users/bottles of wine I've discovered THIS plugin is to blame.

As of recently (I'm not sure exactly when), when you focus a text input, then un-focus it, the screen rockets up to the top. There's nothing you can do about it. I've tried:

  • disableScroll(true)
  • shrinkView
  • automaticScrollToTopOnHiding = false
  • manually getting/setting scrollTop on keyboardWillHide/keyboardDidHide
  • howling at the moon

I'd nearly lost my mind until I removed this webview and used Apache's cordova-plugin-wkwebview-engine. It miraculously stopped acting like it was possessed by a demon, and all was well in the world.

Surely other people are encountering this?

@Serivy
Copy link

Serivy commented Jul 19, 2019

I have been going down this rabbit hole myself trying to find a solution. You're seeing this behavior due to this 'fix'.
#176
in this pull request #201

The cordova have a matching bug which has remained unresolved
apache/cordova-plugin-wkwebview-engine#71
which they tried to use the ionic fix in this pull request
apache/cordova-plugin-wkwebview-engine#75
but it was rejected because people noticed scrolling to the top is often not the intended behavior.
There are JS fixes which do similar (scroll to top)

At present it seems the only solution is to downgrade to XCode 9.

@YCMitch
Copy link
Author

YCMitch commented Jul 19, 2019

That makes so much sense, Serivy. I just moved from Ionic's WKWebview back to Apache's one cause of the abhorrent scroll-to-top thing. I thought it was just a bug.

If I downgrade to Xcode 9, wouldn't I then be unable to use iOS 12 SDK? I was considering that for ages but then read Apple won't approve any apps that don't use the iOS 12 SDK.

@Serivy
Copy link

Serivy commented Jul 19, 2019

Yep, i'm in a similar situation (except I'm not using ionic), i don't want to down grade, and i can't switch back to the old web view (because of rendering bugs that forced us to upgrade), so all I can hope is apple fixes it soon, but doesn't look like a lot of movement given the feedback in those links to apple support.

@Serivy
Copy link

Serivy commented Jul 23, 2019

As an update, I got a XCode 10.3 (10G8) today on my build server and fingers crossed it looks like it works (without the scroll to top fix) while deployed to test flight. That being said i found experimenting on my development xcode of 10.2.1 (10E1001) deployed to device didn't have this problem but couldn't get our build server to replicate it.

@YCMitch
Copy link
Author

YCMitch commented Jul 23, 2019

Cordova's WKWebview and Ionic keyboard with keyboardResizeMode set to body seemed to fix all my scrolling/keyboard/screen issues. It doesn't jump to the top anymore and all works fairly predictably.

It's not great at scrolling down when inputs are focused, but that's pretty easily fixed with JS.

@Amaury-T
Copy link

So there is no other solution than ditching this plugin and use Cordova WKWebview instead?

@YCMitch
Copy link
Author

YCMitch commented Jan 28, 2020

In my experience, yeah. I couldn't find any way around it.

@Gillardo
Copy link

Gillardo commented Feb 7, 2020

I am experiencing this issue as well, when will it be fixed?

@sajallimbu
Copy link

I fixed the issue with this
#342 (comment)

Lindsay-Needs-Sleep added a commit to miloproductionsinc/cordova-plugin-ionic-webview that referenced this issue Mar 21, 2020
…#176) (ionic-team#399)

- We only need the KeyboardWillHide event to fix this problem, and we only need it for ios 11+
- Enable the fix for ios 11+, not only ios 12+. It was probably only 12+ becase no devices have a max OS of 11, so no dev probably confirmed the problem's existance (or non-existance) on 11, myself included.  (But the functionality that started this issue chain began in ios 11.)
- Do some math to make sure the offset when the keyboard goes down dosen't result in empty white space being displayed.
- This solution can potentially be removed when apple finally releases the fix for the issue discussed here: apache/cordova-ios#417 (comment))
Lindsay-Needs-Sleep added a commit to miloproductionsinc/cordova-plugin-ionic-webview that referenced this issue Mar 21, 2020
…#176) (ionic-team#399)

- We only need the KeyboardWillHide event to fix this problem
- Do some math to make sure the offset when the keyboard goes down doesn't result in empty white space being displayed.
- This solution can potentially be removed when apple finally releases the fix for the issue discussed here: apache/cordova-ios#417 (comment)
Lindsay-Needs-Sleep added a commit to miloproductionsinc/cordova-plugin-ionic-webview that referenced this issue Mar 21, 2020
…#176) (ionic-team#399)

- We only need the KeyboardWillHide event to fix this problem, and we only need it for ios 11+
- Enable the fix for ios 11+, not only ios 12+. It was probably only 12+ because no devices have a max OS of 11, so no dev probably confirmed the problem's existence (or non-existence) on 11, myself included.  (But the functionality that started this issue chain began in ios 11.)
- Do some math to make sure the offset when the keyboard goes down doesn't result in empty white space being displayed.
- This solution can potentially be removed when apple finally releases the fix for the issue discussed here: apache/cordova-ios#417 (comment)
Lindsay-Needs-Sleep added a commit to miloproductionsinc/cordova-plugin-ionic-webview that referenced this issue Mar 23, 2020
…#176) (ionic-team#399)

- We only need the KeyboardWillHide event to fix this problem, and we only need it for ios 11+
- Enable the fix for ios 11+, not only ios 12+. It was probably only 12+ because no devices have a max OS of 11, so no dev probably confirmed the problem's existence (or non-existence) on 11, myself included.  (But the functionality that started this issue chain began in ios 11.)
- Do some math to make sure the offset when the keyboard goes down doesn't result in empty white space being displayed.
- This solution can potentially be removed when apple finally releases the fix for the issue discussed here: apache/cordova-ios#417 (comment)
For full details see PR ionic-team#532
Lindsay-Needs-Sleep added a commit to miloproductionsinc/cordova-plugin-ionic-webview that referenced this issue Mar 23, 2020
…#176) (ionic-team#399)

- We only need the KeyboardWillHide event to fix this problem
- Do some math to make sure the offset when the keyboard goes down doesn't result in empty white space being displayed.
- This solution can potentially be removed when apple finally releases the fix for the issue discussed here: apache/cordova-ios#417 (comment)
For full details see PR ionic-team#533
@andaralex
Copy link

As recommended, shall I use this plugin cordova-plugin-wkkeyboardfix?
Is anyone used and publish their app in Apple Store? because they have given note as - plugin is a hack around a bug in iOS. It might result in your app being rejected from the App Store! Use this at your own risk.

@jcesarmobile
Copy link
Member

fixed in #533

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

7 participants