bug: Keyboard pushes the whole screen up
Type: bug
Ionic Version: 2.x
Platform: ios 9 webview
My code has a <ion-toolbar position="bottom"> with a text input inside of it. When I try to type something in there on iOS the whole page gets pushed upwards by the keyboard.
Seeing the same issue in our app on iOS only. On device it always seems to happen, but in iOS emulator it only happens every other time or so. I am actually on ionic 1.7.14
Same problem here + 1 at IOS9
Same issues here at iOS
if(window.cordova && window.cordova.plugins.Keyboard) {
window.cordova.plugins.Keyboard.disableScroll(true);
}
fixed a similar issue for me. It might help. I also had to install the cordova and ionic-cordova typings.
The keyboard doesn't move up with the keyboard though
+1
https://github.com/driftyco/ionic/issues/5302
In my poking around, there appear to be two systems interested in moving content out of the way when the soft keyboard is opened: the underlying native browser and the Ionic2 library itself.
Keyboard.disableScroll(false) (available via the "ionic-plugin-keyboard" cordova plugin) successfully stops the native browser from pushing/scrolling the content pane up and allows the keyboard to slide over and cover existing content.
Under Ionic2 defaults, however, there are additional features in place attempting to both compensate for the keyboard slideover by adding padding to the bottom of your content ('scrollAssist') and to keep the focused input element within the viewport by scrolling back to it ('autoFocusAssist'). Both scrollAssist and autoFocusAssist have nicely implemented switches in config that just don't appear to have gotten public documented yet.
With both sides' behavior disabled, the native keyboard will slide up over existing content without any pushing or scrolling in an Ionic2 (beta.3) app deployed to both iOS 9.2 and Android 6.0. App level configuration sample is in the gist: https://gist.github.com/EvanWillms/8773f8cfa12f469fabf0bdd7a75723e7
@jgw96, I think there are actually two separate issues worth resolving here.
-
A communication need to help reduce the confusion that @ihadeed, @damienadermann and I stumbled into when we want to allow a native keyboard to appear without pushing or scrolling existing content, do not experience much success with the promising looking
Keyboard.disableScroll(true);plugin, and run into a wall. In my mind, the solution for this is some new documentation around thescrollAssistandautoFocusAssistconfiguration options for us to discover and use. -
A reproducible bug in
scrollAssistbehavior nicely documented by @hrpatidar in #5764 wherein a developer who does want some content pushed out of the way of the native keyboard by ionic now has padding on their<content-scroll>element that is not getting removed after the keyboard goes away and leaves a large and unwanted blank space in their scrollable component.
@EvanWillms Hello! Thanks for doing some more research on this issue! So as you can see, this issue, and a couple of the other ones that you commented on have been marked for the beta.5 milestone. We just released beta.4 (yayyy!) so we are currently moving on to beta.5. This means that, at this point, you can expect this issue fixed in the next release of Ionic 2. Thanks again!
same problem on android
@adamdbradley Just a note, this fix (and other keyboard fixes listed in the beta.5 milestone) aren't listed in your google doc for upcoming beta.5 milestones. I'm curious if that means it's been scrubbed from beta.5 (I'd be very sad to hear that) or if the milestones doc hasn't been updated? This doc: https://docs.google.com/document/d/1Qlc5X2eJyOB0izkFlH7KJ5BmMi0MeXUZRHJHt3hS6Wo/edit Thanks!
Is the keyboard-attach feature part of this or a separate issue altogether? Would it be as easy(relatively speaking) as taking the v2 keyboard-attach directive and converting it into a v2 directive? I believe @mhartington had suggested that previously.
@ihadeed I have a chat-like app that also uses ion-toolbar with position bottom with an ion-input inside. How are you handling "keyboard attach" so the toolbar "flows" with the keyboard on input focus?
I did found a solution but I'm not happy with it: https://forum.ionicframework.com/t/keyboard-attach-in-ionic-2/49635
@nunoarruda here is how I implemented it:
<ion-toolbar position="bottom" light>
<form (submit)="addTask()">
<ion-item no-lines>
<ion-input placeholder="Add a new task" [(ngModel)]="taskToAdd"></ion-input>
<button (click)="addTask()" item-right clear>
<ion-icon name="add" lightgreen500></ion-icon>
</button>
</ion-item>
</form>
</ion-toolbar>
@ihadeed thanks for trying to help but that's just markup. I was talking about if/how you programmatically fixed the "keyboard attach" issue
Using that markup outside the ion-content tag solves the problem for me.
@ihadeed https://github.com/ihadeed thanks for trying to help but that's just markup. I was talking about if/how you programmatically fixed the "keyboard attach" issue
— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/driftyco/ionic/issues/5432#issuecomment-218032368
@ihadeed Hum, weird. I am using the code outside ion-content, that's actually where it is supossed to be, but when I focus the ion-input it still stays behind the keyboard. Thanks anyway
Can you provide me with the full markup of your page? I might be able to spot a difference between yours and mine. On May 9, 2016 9:12 PM, "Nuno Arruda" [email protected] wrote:
@ihadeed https://github.com/ihadeed Hum, weird. I am using the code outside ion-content, that's actually where it is supossed to be, but when I focus the ion-input it still stays behind the keyboard. Thanks anyway
— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/driftyco/ionic/issues/5432#issuecomment-218033863
@ihadeed check https://forum.ionicframework.com/t/keyboard-attach-in-ionic-2/49635
Also here's a plunker: http://plnkr.co/edit/AwJiEYptJo9g3stYaNqZ?p=preview
I saw that. I meant I wanted to see the whole page's markup not just the toolbar. On May 9, 2016 9:15 PM, "Nuno Arruda" [email protected] wrote:
@ihadeed https://github.com/ihadeed check https://forum.ionicframework.com/t/keyboard-attach-in-ionic-2/49635
— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/driftyco/ionic/issues/5432#issuecomment-218034328
@ihadeed yeah, sure. check the plunker