Auto hide tabs when keyboard is open
When the keyboard is opened in a tabs page (position=bottom), the tabs appear on top of the keyboard.
The expected behavior is to hide the tabs when the keyboard is visible
Steps to reproduce:
- Create a starter tabs template
- Include an ion-input in the page
- Run it on a device and focus on the input element
Maybe a CSS class can be added to the page when the keyboard is open (.keyboard-is-open) so that the behavior can be controlled
This issue is for Ionic 2
Cordova CLI: 5.2.0 Gulp version: CLI version 3.9.0 Gulp local: Local version 3.9.1 Ionic Framework Version: 2.0.0-beta.9 Ionic CLI Version: 2.0.0-beta.30 Ionic App Lib Version: 2.0.0-beta.16 OS: Node Version: v4.3.2
Yeah, I assume you're under Android. The old keyboard problem...
I saw a talk on PhoneGap conf of @tlancina about the keyboard and it seems to be a pretty hard issue in general! I can confirm that the bottom tab bar is pushed up upon opening the keyboard in my app under Android, too. But much more worse is covering input fields which are near the bottom. Tim said, one should try to avoid that, but unfortunately there are long lists to edit in my project. I have postponed the whole keyboard topic to wait and see how it plays out in ionic.
Besides, @tlancina, is there a best practice tutorial about using the keyboard in ionic (integrating the ionic keyboard plugin, init/setting event handlers)?
I am experiencing this issue as well.
We are having the same issue in our project too. Any plans regarding this?
Hey guys, also feeling the pain - any news by any chance?
also need this great feature, tabs and may be even header nice to be able to hide.
@jgw96 I noticed you added the enhancement label on this. Since native apps do no behave the same (moving tabs above the keyboard) and the tabs are also limit the actual content real estate to just a couple lines, especially on smaller phones, shouldn't this be consider a more serious issue?
For people looking for a temporary solution, here's what I did:
TabsComponent constructor:
platform.ready().then(() => {
Keyboard.onKeyboardShow().subscribe(() => {
document.body.classList.add('keyboard-is-open');
});
Keyboard.onKeyboardHide().subscribe(() => {
document.body.classList.remove('keyboard-is-open');
});
});
Inside the CSS:
body.keyboard-is-open ion-tabbar {
display: none;
}
body.keyboard-is-open scroll-content {
margin-bottom: 0 !important;
}
This won't work if you have multiple tabs on a page, but I guess you can select them with your CSS directly.
I'm currently running Ionic beta 11
any update on this?
@bvx89 Thanks.
For the sake of those on Rc0 there's a slight change on the css
body.keyboard-is-open .tabbar {
display: none;
}
body.keyboard-is-open .scroll-content {
margin-bottom: 0 !important;
}
No official solution yet tho
Just to mention that enabling Fullscreen mode on Android also fixes this issue for me.
This can be done by setting
<preference name="Fullscreen" value="true" />
in config.xml, and optionally adding cordova-plugin-fullscreen if you're using a cordova android platform older than v5.0.0.
Is this going to be fixed in the next version along with the rest of keyboard issues that are going to be fixed (read something stating that about keyboard issues in another thread) or has this fallen between the cracks?
@RaymondAtivie i have same issue, Is this going to be fixed in the next version?
It's not working for me in RC3. the onKeyboardShow() is never fired...
+1, i have same issue.
Cordova CLI: 6.3.1 Ionic CLI Version: 2.1.8 Ionic App Lib Version: 2.1.4 ios-deploy version: Not installed ios-sim version: Not installed OS: Windows 8.1 Node Version: v6.4.0 Xcode version: Not installed
I have this same issue, and the workaround posted by @RaymondAtivie isn't working quite right. the tabs are no longer visible, but there appears to be a top border still visible. Anyone else have this issue? I've tried adding
box-shadow: none;
border-top: none;
and still end up with the same top border visible from the tabbar. Any ideas?
I've solved this issue by turning ion-content option fullscreen="true"
and setting hidden style for tabbar
var tabbars = document.getElementsByClassName('tabbar');
for(var i=0; i<tabbars.length; i++) {
var node = <HTMLElement>tabbars[i];
node.style.display = hide === true && 'none' || 'block';
}
I've tried this and still have the same top border showing even though the tabbar is set to display false.
@payneBrandon I'm hiding top bar
<ion-header *ngIf="isShowHeader()">
My ion-tab is at the bottom, so hiding the header doesn't affect it much. I've attached a screenshot of what I'm talking about. The keyboard is shown, the tabs at the bottom are hidden, but it still appears that there is some top boarder line that stays in place if i scroll around.

this bar looks like a part of the form can you share your html code?