question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: Window does not resize correctly when keyboard is open and alert pops up (Android)

See original GitHub issue

Bug Report

Ionic version:

[x] 4.x

Current behavior:

This bug appears only on Android. When you have focused on an input field (e.g. ion-input) and the keyboard is open, if an alert is presented (or other presentables) the keyboard closes, but the window/app content does not resize, leaving a big blank space under the content. This also affects the ion-virtual-scroll element on the previous page if the alert pops up through a router angular guard when clicking the back button (let’s say a “discard changes alert” scenario).

Expected behavior:

Window should resize before opening the alert, so that no blank space appears and also ion-virtual-scroll can calculate content size correctly.

Steps to reproduce:

  • Clone this repo: https://github.com/anagstef/ionic-alert-keyboard-resize-bug
  • Run npm i
  • Run ionic build
  • Run npx cap sync android
  • Run npx cap open android
  • On the device, click any of the items on the main home screen (after the tutorial)
  • Focus on the ion-input on top of the screen (“Click here to focus input”)
  • Tap the navigation back button on the header toolbar of the app
  • Bug happens, also when you tap “Yes” you return to the previous screen which is empty because it’s virtual scroll

Related code: https://github.com/anagstef/ionic-alert-keyboard-resize-bug

Check latest commit.

Other information:

Screenshot_2019-09-18-16-31-00 screenshot ends here

Ionic info:

Ionic:

   Ionic CLI                     : 5.2.8 (/Users/anagstef/.nvm/versions/node/v10.15.3/lib/node_modules/ionic)
   Ionic Framework               : @ionic/angular 4.7.0
   @angular-devkit/build-angular : 0.801.2
   @angular-devkit/schematics    : 8.1.1
   @angular/cli                  : 8.1.1
   @ionic/angular-toolkit        : 2.0.0

Capacitor:

   Capacitor CLI   : 1.2.1
   @capacitor/core : 1.2.1

Cordova:

   Cordova CLI       : 8.0.0
   Cordova Platforms : android 8.0.0
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.1, (and 5 other plugins)

Utility:

   cordova-res : not installed
   native-run  : 0.2.7 (update available: 0.2.8)

System:

   ios-deploy : 1.9.4
   ios-sim    : 8.0.1
   NodeJS     : v10.15.3 (/Users/anagstef/.nvm/versions/node/v10.15.3/bin/node)
   npm        : 6.11.3
   OS         : macOS Mojave
   Xcode      : Xcode 10.3 Build version 10G8

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:5
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
MarcAndreCcommented, Sep 23, 2019

This issue have already been discussed here. https://github.com/ionic-team/ionic/issues/19065

There is some hack too!

1reaction
MarcAndreCcommented, Sep 20, 2019

I noticed that bug too on my pixel 2, but it not append on virtual device… I’ve discover that uninstalling updates from “Android System Webview” (in my case, it downgrade from 76 to 74) app make the bug not occuring anymore. Sound like a new breaking change from Android system webview.

Read more comments on GitHub >

github_iconTop Results From Across the Web

bug: Window does not resize correctly when keyboard is open ...
This bug appears only on Android. When you have focused on an input field (e.g. ion-input ) and the keyboard is open, if...
Read more >
android - DialogFragment not resizing when keyboard shown
I just use the following line in my DialogFragment: getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.
Read more >
Popup keyboard hides parts of the UI rather than resizing
On Android, when I tap the Entry , the keyboard slides up, but the UI slides up as well, getting rid of the...
Read more >
Handle input method visibility | Android Developers
When input focus moves in or out of an editable text field, Android shows or hides the input method—such as the on-screen keyboard—as ......
Read more >
Adjusting elements when keyboard shows in Xamarin Forms
When developing forms, a good practice is that when the keyboard is shown we shouldn't hide the text entries behind it.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found