ionic-framework: bug: Viewport Size - Keyboard - Chrome/Webview v76.x - Android
Bug Report
Ionic version: [x] 4.x
Current behavior:
Viewport doesn’t get resized on closing & opening of keyboard. This causes issues focusing on input fields & button as it hides behind the keyboard.
The issue came ever since the new update of Chrome/Webview 76.x
Screenshot below

Expected behavior:
The viewport resizes as per visible screen when keyboard opens up.
As you can see in the screenshot , the login form is vertically centered and it has been working flawlessly before this recent chrome update

Steps to reproduce/ Related Code:
Write a div and apply following css properties to the parent element of that div (i.e. body)
display: flex;
flex-direction: column;
justify-content: center;
Other information:
Another issue that came along with this was, in some older phone i.e android v8 & below - upon closing the keyboard, the viewport size did not reduce and the area size of keyboard would have a blank white screen.

Ionic info:
Ionic:
Ionic CLI : 5.2.4 (C:\Users\PRARACHN\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : @ionic/angular 4.2.0
@angular-devkit/build-angular : 0.13.8
@angular-devkit/schematics : 7.2.4
@angular/cli : 7.3.8
@ionic/angular-toolkit : 1.4.1
Cordova:
Cordova CLI : 9.0.0 (cordova-lib@9.0.1)
Cordova Platforms : android 8.0.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.1.1, (and 18 other plugins)
Utility:
cordova-res : not installed
native-run : 0.2.8
System:
NodeJS : v12.8.0 (C:\Program Files\nodejs\node.exe)
npm : 6.10.2
OS : Windows 10
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 9
- Comments: 30 (6 by maintainers)
Hi everyone,
I wanted to provide an update on this issue.
We believe this might be a bug in Chrome 76. When running in a WebView, the
htmlandion-appelements are resized down when the keyboard is opened, and then resized back to their original sizes when the keyboard is closed. On Chrome <= 75 this works as expected; however, on Chrome 76 only thehtmlelement is resized back to its original size.In order to ensure
ion-appis recalculated properly we need to force a layout/reflow on the page. Here is a temporary workaround that you can place in your application’s code:We are looking into reporting this bug to the Chrome team for them to take a look at. I will post here with any future updates.
Thanks!
@Ross-Rawlins Thanks for the tip! Saved my day.
Our current solution ended up as follows:
(We put above in main.ts.)
The cause appears similar but the implication are different. #19015 issue is about scrolling, in my case, the issue makes the application entirely non usable for my users. The keyboard leaves a blank white portion unused which is causing a huge influx of user feedback pertaining to the issue.
In smaller screen devices, the login form has become completely non accessible to the user.
It has been 4 days since the issue & user application experience has been down the drain because of this issue.
The only good thing in all this fiasco is that iPhone App users are not affected by this.
I can reproduce this. We are actively investigating a fix and will post here when we have an update.
Thanks!
We have the same issue. The enclosing ion-page element don’t resize properly. Every time the ion-input lose focus by clicking on an external element (for example dismiss the parent modal or open the popover of another ion-select …).
thx @ippeiukai for the workaround, it works like a charm!
for those interested, I’ve made one or two changes to the script. Notably loading it on
DOMContentLoadedinstead ofdeviceready(for those who don’t have a Cordova platform or so), added theresizeevent (when the browser window is resized) as fallback and also an unsubscribe of the event when the client leave the site (you never know 😉)Feedbacks and improvements welcomed!
Thanks for the issue. Are you able to provide a repo with the code required to reproduce this issue?
Same issue on Android 9 Samsung A8. Any solution yet?
The fix works fine for most pages here. Not for the pages on which I have ion-slides.
Hey,
There is a sample repo at https://github.com/ionic-team/ionic/issues/19088 : https://github.com/cmeuser/LoadingController
Reproducible on Cordova and Capacitor projects
@siddharth-pand8y I faced the same problem wherever using ion-input element. Hopefully this will be fixed soon, cause it makes ion-input unusable all over the app. We created an ugly workaround by changing a style of the current page to force a rerender after the keyboardDidClose event was fired.