ionic-framework icon indicating copy to clipboard operation
ionic-framework copied to clipboard

bug: White Background overlays view on Keyboard show / hide on Android

Open malifai opened this issue 11 years ago • 39 comments

Type: bug

Platform: android 5.x webview

Platform: Android (5.0, not tested on other devices)

Ionic: 1.0.1 (Vanadium...)

Prerequisites:

  • < preference name="Fullscreen" value="true"/>
  • ionic.Platform.isFullscreen = true;
  • $ionicConfigProvider.scrolling.jsScrolling(false); ( i mention this because i added this in the new version, since there were so many problems in 1.0.0 regarding native scrolling and input focus issues with keyboard)
  • (Crosswalk is used, version 13+)

2 Issues:

  1. When focusing an input field, a white background appears behind the keyboard (sometimes it extends up to 20-30px above the keyboard, overlaying the view). Hiding the keyboard makes the background visible for about 200-300ms after the keyboard is hidden and before it fades away. (Timing issues?)
  2. When focusing an input field, the keyboard shows, then focusing a select box hides the keyboard correctly, but the white background is still overlaying the bottom half of the view. Closing the select menu will NOT remove the white background. Only focusing an input again will correct the view (and we return to bug 1...)

An similar issue as an example can be seen here: http://forum.ionicframework.com/t/white-background-shows-when-keyboard-closes-on-android/25258

Solution: Removing the line "ionic.platform.isFullscreen = true" solves both issues for me. There seems to be no impact for iOS (ionic.platform.isFullscreen = true; is still set for iOS)

malifai avatar Jul 08 '15 09:07 malifai

Do you have a background color in that view?

mhartington avatar Jul 14 '15 20:07 mhartington

Well the pane has #fff per default i guess. thats it.some elements of course, but not white.

malifai avatar Jul 14 '15 21:07 malifai

Just tested this out on a nexus 5 running android 5.0, wasn't able to reproduce it. Is there any more information you could provide? Perhaps a video of it happening?

mhartington avatar Jul 15 '15 17:07 mhartington

I have the exact same issue, with the combination of 'fullscreen' and 'native scrolling'. I can reproduce with or without Crosswalk on my Galaxy Tab 4 (Android 4.4.2).

Different versions of ionic-plugin-keyboard (1.0.0, 1.0.4 or 1.0.5) all had the same result.

I've recorded a video of it happening. @kryptikal could you confirm this is what you're seeing? https://cloudup.com/cgQAOEjjvSI

DURK avatar Jul 16 '15 10:07 DURK

Yes. Exactly the same.

malifai avatar Jul 16 '15 10:07 malifai

I got the same issue for the 20/30px extends above keyboard. Since my application background is not white but dark color, it looks like quite ugly. I "hide" this issue by setting my background color on the ion-view element instead of the ion-content. This is not really a workaround but just hides the problem. It also solves the problem that shows a white background during 200/300ms after the keyboard hides. Another user already opens an issue https://github.com/driftyco/ionic/issues/3817 for that.

About the second issue, I used to had the same one as you, so I had a look a found two others issue which duplucate this one with two different workaround: https://github.com/driftyco/ionic/issues/3927 and https://github.com/driftyco/ionic/pull/4007. You could try one of them until the problem is solved in future Ionic release.

amazaud avatar Jul 20 '15 08:07 amazaud

@DURK would you be able to provide some markup for this particular view? Maybe even a minimal codepen for me to pull down and test on.

mhartington avatar Jul 20 '15 14:07 mhartington

Greetings @kryptikal!

My sensors indicate a reply was requested, but as we have not received one yet, I am using my robot powers to close this issue. However, if you are still experiencing this issue, please feel free to reopen it by creating a new issue, and include any examples or necessary information.

Thank you for allowing me to assist you.

Ionitron avatar Aug 19 '15 15:08 Ionitron

Greetings @kryptikal!

My sensors indicate a reply was requested, but as we have not received one yet, I am using my robot powers to close this issue. However, if you are still experiencing this issue, please feel free to reopen it by creating a new issue, and include any examples or necessary information.

Thank you for allowing me to assist you.

Ionitron avatar Aug 19 '15 15:08 Ionitron

Did #4007 fix this?

mlynch avatar Dec 06 '15 23:12 mlynch

Experiencing the exact same issue here.

VinceOPS avatar Dec 15 '15 22:12 VinceOPS

Same Issue. When I hide the keyboard in Android, the screen bounces and shows white image,

phyr0s avatar Jan 15 '16 13:01 phyr0s

A potential workaround for the white background not disappearing is adding the following code where you want the keyboard to close, for example in an event handler for enter keystroke or submit form event. You also need to add $ionicScrollDelegate as a dependency. if (cordova) { cordova.plugins.Keyboard.close(); } $ionicScrollDelegate.getScrollView().resetScrollView()

danieka avatar Jan 22 '16 14:01 danieka

Update: only doesn't work when if preference is true, works well but.... if you disabled the fullscreen preference you can't see the input focused on android because the keyboard is above the input, textarea etc...

phyr0s avatar Jan 25 '16 16:01 phyr0s

Hello all! Is this still an issue with ionic 1.3.0?

jgw96 avatar Apr 27 '16 18:04 jgw96

Yes

El miércoles, 27 de abril de 2016, Justin Willis [email protected] escribió:

Hello all! Is this still an issue with ionic 1.3.0?

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/driftyco/ionic/issues/4057#issuecomment-215192406

phyr0s avatar Apr 27 '16 18:04 phyr0s

Hello all, thanks for opening an issue with us! As i cannot seem to reproduce this on any of my Android devices (Nexus 6 running latest Android N dev preview, Nexus 7 2013 running Android 6.0.1 and a Moto X 2014 running Android 5.1.1) i will be closing this issue for now. If anybody could post a minimal example that i can use to reproduce this issue i will happily reopen. Thanks for using Ionic!

jgw96 avatar Jun 21 '16 19:06 jgw96

Hi @jgw96, you can download the app "Happnd" which was presented on the ionic blog recently... There is one screen with a not-white background, and as far as I remember, I saw the issue on this one, opening and closing the keyboard.

VinceOPS avatar Jun 21 '16 19:06 VinceOPS

@jgw96 Actually, the issue also exists on ionic 2. Run a sample app on Android with a background picture (in the current view) and make the keyboard pops up. You'll see the "white" space under the keyboard until it completely disappears.

VinceOPS avatar Jul 02 '16 19:07 VinceOPS

I can trigger this issue pretty easily, using Ionic 1.3.1. I've forked the ionic-starterapp-sidemenu project to demonstrate that. The relevant edits are these 2 commits:

  1. add an input field to demonstrate issue (commit)
  2. add a call to ionic.Platform.fullScreen from, within $ionicPlatform.ready() (commit)

You can run the following commands to see this issue in action:

  1. ionic start test_app https://github.com/YellowSharkMT/ionic-starter-sidemenu
  2. ionic platform add android
  3. ionic run android
  4. tap in the input field, the issue should occur.
  5. add'l info: something is setting the css height of the element to an incorrect value, this can be observed by using the chrome://inspec feature in Google chrome to debug the webview.

I had that code in place (referring to the call to ionic.Platform.fullScreen()) to address a quirk in our app that was affecting the size of our header, but that was on the 1.1.x branch, and I overlooked it as a possible source of an issue with our app after we upgraded to 1.3.x. I'm definitely open to the possibility that I'm "doing it wrong", as they say. Not sure how I settled on that code, TBH, was over a year ago. Anyhow, hope this is helpful to someone.

YellowSharkMT avatar Aug 24 '16 17:08 YellowSharkMT