Fix(iOS): Issues related to keyboard dismissal (2.x) #532
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Sister PR for 4.x: PR #533
The history of the keyboard dismissal problems are kind of messy so here we go:
1)
The main bug that started this all is reported here:
To summarize: Apple did something and broke a part of WKWebView for iOS 12 and 13. The problem occurs when the keyboard is dismissed. After dismissal the bottom part of the page has a white unused portion / the content behind the keyboard becomes unusable.
The issue is truly an apple problem. So this PR, and the previously accepted PR #201, should not be required if apple ever actually releases the fix. (The fix has been completed already apparently).
You can see the apple bug report links here.
2)
PR #179 and PR #201 attempt to fix this problem.
3)
Unfortunately, PR #201 introduces another a secondary bug, #399.
Now, when the keyboard is dismissed the screen scrolls all the way back to the top.
(Also reported in cordova-plugin-ionic-keyboard #84.)
4)
To fix the scroll to top issue we have PR #342. Unfortunately, this introduces another (less problematic bug): the view now "jumps" a little when moving between text fields.
Proposed Solution
Modify the changes from PR #201 using inspiriration from PR #342.
In KeyboardWillHide event:
Environment
I have been testing with:
My project is:
I have been testing on these devices:
I have also tested this change with, and without, the changes in PR #530
I have also tested the 4.x sister PR #533 (which has identical changes basically) with these projects:
modified ionic tutorial
modified cordova helloWorld
Summary
Fixes:
Compatible with PR #530.
Alternate Solution
Pros:
Cons:
(tested this plugin on the ionic and cordova project for 4.x, and cordova for 2.x)
Since this plugin has already fixed this issue, I suppose it is probably better to just fix the fix at this point rather than this.