Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] content disappears when keyboard is up #10183

Closed
AmitMY opened this issue Jan 26, 2017 · 19 comments · Fixed by #11586
Closed

[BUG] content disappears when keyboard is up #10183

AmitMY opened this issue Jan 26, 2017 · 19 comments · Fixed by #11586
Assignees
Labels
ionitron: v3 moves the issue to the ionic-v3 repository

Comments

@AmitMY
Copy link
Contributor

AmitMY commented Jan 26, 2017

Ionic version: (check one with "x")
[ ] 1.x
[x] 2.x

I'm submitting a ... (check one with "x")
[x] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/

Current behavior:
When having slides, with a scroll, as suggested here, in the last comment, the content disappears when opening the keyboard, except for the first input.

Note: this happens on device, in this example I am using an android emulator, but it also happens if you serve and open the page via iPhone.

Here is a video demonstration

Expected behavior:
Normal input behavior

Steps to reproduce:
As said, I am running this on a device, so plunkr won't work.
This is the relevant code:

<ion-slides #slider pager class="swiper-no-swiping">
    <ion-slide class="scroll-content">
        <ion-scroll scrollY="true">
            <h2>Tab title</h2>
            <ion-list>
                <ion-item *ngFor="let i of [1,2,3,4,5,6,7,8,9,10]">
                    <ion-label floating>Text field</ion-label>
                    <ion-input type="text" [(ngModel)]="text"></ion-input>
                </ion-item>
            </ion-list>
        </ion-scroll>
    </ion-slide>
</ion-slides>

This is the CSS:

ion-scroll {
	position: absolute;
	top: 0;
	bottom: 0;
	width: 100%;
}

Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):

Your system information:

 ordova CLI: 6.4.0
Ionic Framework Version: 2.0.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 0.0.47
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v6.9.1
Xcode version: Not installed
@mhartington mhartington added the v2 label Jan 26, 2017
@jgw96
Copy link
Contributor

jgw96 commented Jan 26, 2017

Hello @AmitMY , thanks for opening an issue with us and a HUGE thanks for the detailed info and repro case. We will take a look into this.

@mattbryan9
Copy link
Contributor

mattbryan9 commented Jan 27, 2017

I have this as well, with an ion-content inside an ion-slide. Unfortunately, everything in the ion-slides remains invisible after the keyboard is closed; I can actually interact with elements, type into inputs, etc, but can't see anything. Any manual changes to styling (i.e. in the web inspector) immediately make the contents of the slider visible again. For us this only happens on iOS.

<ion-slides runCallbacksOnInit="true" [pager]="false"(ionSlideDidChange)="onSlideChange()">
    <template [ngIf]="condition">
        ${require('./foo.html')}
    </template>
    <template ngFor let-s [ngForOf]="slides" let-i="index">
        <ion-slide layout="column">
            <ion-content flex fullscreen="true">
                <div>
                   content goes here
                </div>
            </ion-content>
        </ion-slide>
    </template>
</ion-slides>
Cordova CLI: 6.4.0
Ionic Framework Version: 2.0.0
Ionic CLI Version: 2.1.13
Ionic App Lib Version: 2.1.7
ios-deploy version: 1.9.0
ios-sim version: 5.0.11
OS: macOS Sierra
Node Version: v4.5.0
Xcode version: Xcode 8.2.1 Build version 8C1002

@chrislow
Copy link

chrislow commented Feb 2, 2017

1+ same issue here, using inputs inside slides. [Image here].(#6228 (comment))

#6228

Cordova CLI: 6.4.0
Ionic Framework Version: 2.0.0
Ionic CLI Version: 2.1.18
Ionic App Lib Version: 2.1.9
Ionic App Scripts Version: 1.0.0
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v6.6.0
Xcode version: Not installed

@ghaiat
Copy link

ghaiat commented Feb 6, 2017

any update on this ? or any workaround?

@daraul
Copy link

daraul commented Apr 7, 2017

I had this issue, but found this fix on stackoverflow. So far this seems like an alright solution, but I'm not certain. I took some screenshots in Chrome's devtools:

Without keyboard:
image

With keyboard:
image

@manucorporat manucorporat reopened this Jun 14, 2017
@manucorporat manucorporat self-assigned this Jun 14, 2017
@zakton5
Copy link
Contributor

zakton5 commented Sep 15, 2017

+1

2 similar comments
@chrismclarke
Copy link

+1

@aymehri
Copy link

aymehri commented Dec 3, 2017

+1

@milanosie
Copy link

Problem still open.... Having the same issue here

@gbrits
Copy link

gbrits commented Dec 10, 2017

.scroll-content {
    margin-bottom: -56px !important;
}
ion-content > div {
    padding: 0 !important;
    margin: 0 !important;
}

@tr049
Copy link

tr049 commented Dec 13, 2017

Facing same issue

@llalueza
Copy link

llalueza commented Dec 22, 2017

Same issue on my side too and it seems there´s no fix/temporal patch working like in other versions.

Working with Ionic 3.
Coming from: #12661

@ghost
Copy link

ghost commented Dec 22, 2017

have same issue here.
cli packages: (/usr/local/lib/node_modules) @ionic/cli-utils : 1.19.0 ionic (Ionic CLI) : 3.19.0 global packages: cordova (Cordova CLI) : 7.1.0 local packages: @ionic/app-scripts : 3.1.4-201711302144 Cordova Platforms : android 6.3.0 Ionic Framework : ionic-angular 3.9.2 System: Node : v6.11.4 npm : 3.10.10 OS : OS X El Capitan Xcode : Xcode 8.2.1 Build version 8C1002

i have try with this but not working

https://gist.github.com/EvanWillms/8773f8cfa12f469fabf0bdd7a75723e7

config: { // These options are available in ionic-angular@2.0.0-beta.2 and up. scrollAssist: false, // Valid options appear to be [true, false] autoFocusAssist: false // Valid options appear to be ['instant', 'delay', false] } // http://ionicframework.com/docs/v2/api/config/Config/

is not supported with ionic 3 i guess

@iamongit
Copy link

iamongit commented Mar 5, 2018

Is there an actual solution for this issue anywhere? I've found at least a dozen threads linking each other but no definitive solution. I've wasted lot of time on it, tried all solutions but nothing is working. The scrolling behavior on focus is unpredictable.

@polfernandez
Copy link

polfernandez commented Mar 6, 2018

after long research and reading that this issue is still open in cordova/ionic, I decided to solve the issue by myself.
The idea is to adapt the header's height programmatically depending on the keyboard's height.

1.- On the header of the view template (HTML) attach a style directive:

<ion-header [ngStyle]="getKeyboardStyle()" >

2.- On the component (TS) I triggering the keyboard's events (show, hide) and the height value:

  Observable.merge(this.nativeKeyboard.onKeyboardShow(), this.keyboard.didShow)
    .subscribe((e: any) => {
      this.keyboardHeight = e.keyboardHeight;
    });

 Observable.merge(this.nativeKeyboard.onKeyboardHide(), this.keyboard.didHide)
    .subscribe((e: any) => {
      this.keyboardHeight = e.keyboardHeight | 0;
    });
}

Where this.keyboardHeight is a global variable number type. And this.keybaord and this.nativeKeyboard are the cordova plugins.

3.- Finally, this is the method returning the height attached to the ngStyle directive of the header:

  getKeyboardStyle() {
    let style = {
      'top': this.keyboardHeight ? this.keyboardHeight + 'px' : '0px'
    }
    return style;
 }

I hope that this can help.

@pradt
Copy link

pradt commented Jun 19, 2018

@gbrits solution worked for me thank you.

@carvarr
Copy link

carvarr commented Jul 29, 2018

any solution ?

@adamdbradley adamdbradley added the ionitron: v3 moves the issue to the ionic-v3 repository label Nov 1, 2018
@imhoffd imhoffd removed the ionitron: v3 moves the issue to the ionic-v3 repository label Nov 28, 2018
@imhoffd imhoffd removed the ionitron: v3 moves the issue to the ionic-v3 repository label Nov 28, 2018
@Ionitron Ionitron added the ionitron: v3 moves the issue to the ionic-v3 repository label Nov 28, 2018
@ionitron-bot
Copy link

ionitron-bot bot commented Nov 28, 2018

This issue has been automatically identified as an Ionic 3 issue. We recently moved Ionic 3 to its own repository. I am moving this issue to the repository for Ionic 3. Please track this issue over there.

If I've made a mistake, and if this issue is still relevant to Ionic 4, please let the Ionic Framework team know!

Thank you for using Ionic!

@ionitron-bot
Copy link

ionitron-bot bot commented Nov 28, 2018

Issue moved to: ionic-team/ionic-v3#170

@ionitron-bot ionitron-bot bot closed this as completed Nov 28, 2018
@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Nov 28, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
ionitron: v3 moves the issue to the ionic-v3 repository
Projects
None yet
Development

Successfully merging a pull request may close this issue.