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

ionic2 slides keyboard bug

Open jurienhamaker opened this issue 10 years ago • 24 comments

Short description of the problem:

I got a couple of slides, and the last one of them has a login form. whenever I try to type in the input fields, the keyboard pops up and the slides are broken, they're auto resized to the space left, and after closing the keyboard they stay that way.

What behavior are you expecting?

I am expecting it to be pushed up (like usual phone behavior I guess?) and make it possible to use form fields in slides.

Steps to reproduce:

  1. Create a view with slides
  2. add a form to one of the slides (even one input fiels will do)
  3. Tap the input field, tada.
        <ion-slide>
            <img src="img/superbuddy_logo.png" class="slide-img"/>
            <h2 class="slide-title">Let's get started!</h2>
            <ion-item>
                <ion-label>username</ion-label>
                <ion-input></ion-input>
            </ion-item>
            <ion-item>
                <ion-label>password</ion-label>
                <ion-input type="password"></ion-input>
            </ion-item>
            <button full>Log in</button>
            <div class="divider"></div>
            <button outline>
                <ion-icon name="logo-facebook"></ion-icon>
                Log in with facebook
            </button>
            <div class="divider"></div>
            <button clear>Create new account?</button>
        </ion-slide>

Ionic Version: 1.x / 2.x 2

Browser & Operating System: iOS / Android / Chrome All of them.

Run ionic info from terminal/cmd prompt:

Cordova CLI: Not installed
Ionic Version: 2.0.0-beta.1
Ionic CLI Version: 2.0.0-beta.17
Ionic App Lib Version: 2.0.0-beta.8
OS:
Node Version: v5.5.0

jurienhamaker avatar Feb 23 '16 15:02 jurienhamaker

Any progress on this issue?

alpotapov avatar Mar 18 '16 19:03 alpotapov

Given this description of space being suddenly claimed by the keyboard when an input field is tapped and then not released afterward, this sounds like another effect of #5432.

@HazeDevelopment, @alpotapov: You might be able to make use of the workaround I found to let the keyboard slide over the content, preventing it from getting permanently squished: https://forum.ionicframework.com/t/disable-scroll-ionic2-ios9-not-working/44847/5?u=evanwillms

@brandyscarney: I would guess that this issue shares a root cause with #5432 and is unrelated to potential work in #6007, but you should probably have someone more familiar verify.

EvanWillms avatar Apr 10 '16 21:04 EvanWillms

related to #5744

jgw96 avatar Apr 12 '16 16:04 jgw96

An plunkr example of a form with various input components within an <ion-slides>: http://plnkr.co/edit/i0MIv8mlQ5WljUJxlBAs?p=preview

The form creates all sorts of chaos. Granted this is quite a big form, but this is just an example.

  • Cannot scroll through the form.
  • Pager moves when the form scrolls.
  • Swiping back and forth messes between pages while capturing input messes with the pager, the vertical padding and scroll position of the other slides.

dylanvdmerwe avatar Apr 20 '16 09:04 dylanvdmerwe

Hey everyone! Just wanted to let the community know that we are currently making alot of changes to slides for beta.5, along with some much better docs, so look out for fixes for slides in beta.5! (:

jgw96 avatar Apr 20 '16 14:04 jgw96

Any news about this bug? I having exactly the same problem....:(

eusthace811 avatar Jun 07 '16 23:06 eusthace811

Hello all! Is this still an issue with Ionic 2 beta.10? Thanks!

jgw96 avatar Jun 30 '16 17:06 jgw96

Hello all! As it seems it has been a while since there was any activity on this issue i will be closing it for now. Feel free to comment if you are still running into this issue. Thanks for using Ionic!

jgw96 avatar Jul 06 '16 16:07 jgw96

I'm still facing this issue

haroondilshad avatar Jul 18 '16 09:07 haroondilshad

Still experiencing this issue as well

sarahtully avatar Aug 08 '16 19:08 sarahtully

Is there any solutions to this issue yet? I am using Ionic 2 RC1 and having this problem. I put my login form on a slider, then on iPhone if I tap on the input box then if I move away the focus from the textbox and tap again then the form moves up. Please see the screenshot. I tried Keyboard.disableScroll(true) but didn't work. I am not sure how to use scrollAssist and autoFocusAssist with RC1 though.

img_5115

creativeitacademy avatar Oct 18 '16 10:10 creativeitacademy

Same here with RC2. Bug happens on iOS, not on Android, not in browser Here is a full report on the bug

On Simulator


Initial screen = normal

simulator screen shot 10 nov 2016 a 23 15 43

Entering first field = content goes mostly off screen, almost all blank, second field disappeared

simulator screen shot 10 nov 2016 a 23 16 05

Entering second field = content goes again off screen, biiiiig time !!

simulator screen shot 10 nov 2016 a 23 16 22

Typing in second field = first field has been pushed up again

simulator screen shot 10 nov 2016 a 23 16 27

Leaving second field = back to normal

simulator screen shot 10 nov 2016 a 23 16 33

On Device

Initial screen = normal

img_0448

Entering first field = content goes mostly off screen, now we can see why (keyboard), second field has disappeared also

img_0449

Exiting first field = second field label re-appears

img_0450

Entering second field = not pushed as much as on simulator

img_0451

Leaving second field = back to normal !

img_0452

Re-entering second field = biiiiiig mess

img_0453

Info

Your system information:

Cordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.2
Ionic CLI Version: 2.1.7
Ionic App Lib Version: 2.1.4
Ionic App Scripts Version: 0.0.42
ios-deploy version: 1.9.0
ios-sim version: 5.0.10
OS: macOS Sierra
Node Version: v7.0.0
Xcode version: Xcode 8.1 Build version 8B62

HTML

<ion-content class="init">
    <ion-slides pager #slider [options]="options">
        <ion-slide>
            <ion-toolbar>
                <ion-buttons end>
                    <button ion-button (click)="letSlide()">Next</button>
                </ion-buttons>
            </ion-toolbar>
            <h2 class="slide-title">Welcome</h2>
            <p>
                Click next to begin the initialization.
            </p>
        </ion-slide>
        <ion-slide>
            <h2 class="slide-title">Credentials</h2>
            <p>Please enter your serial number and email address</p>
            <form [formGroup]="credentialsForm" (ngSubmit)="submitCredentials(credentialsForm.value)">
                <ion-item>
                    <ion-label floating>Serial</ion-label>
                    <ion-input type="text" formControlName="serial"></ion-input>
                </ion-item>
                <ion-item>
                    <ion-label floating>Email</ion-label>
                    <ion-input type="email" formControlName="email" clearInput></ion-input>
                </ion-item>
                <div padding>
                    <button ion-button color="primary" block type="submit" [disabled]="!credentialsForm.valid">Validate</button>
                </div>
            </form>
        </ion-slide>
                <ion-slide>
                   Whatever
                </ion-slide>
        <ion-slide>
            <h2 class="slide-title">Ready to Play?</h2>
            <button ion-button large clear (click)="initDone()">
                Continue
                <ion-icon name="arrow-forward"></ion-icon>
            </button>
        </ion-slide>
    </ion-slides>
</ion-content>

TypeScript

import { Component, ViewChild } from '@angular/core';
import { NavController, Slides } from 'ionic-angular';
import { Validators, FormBuilder, FormGroup } from '@angular/forms';
import { HomePage } from '../../pages/home/home';


@Component({
    templateUrl: 'init.html',
})
export class InitPage {
    @ViewChild('slider') slider: Slides;
    nav: NavController;
    credentialsForm: FormGroup;
    slides: any;
    options: any;

    constructor(public navCtrl: NavController, public fb: FormBuilder) {
        this.nav = navCtrl;
        this.credentialsForm = this.fb.group({
            serial: ['', [Validators.required, Validators.pattern('^[A-Fa-f0-9]{16}$')]],
            email: ['', [Validators.required, Validators.pattern('^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$')]]
        });
        this.options = {
            pager: true,
            onlyExternal: true
        };
    }


    letSlide(self: any = this): void {
        self.slider.slideNext();
    }

    submitCredentials(data): void {
        this.letSlide(this));
    }

    initDone(): void {
        this.navCtrl.setRoot(HomePage);
    }
}

Safari inspector (on simulator)

When everything is normal, ion-content inserts a div with class="scroll-content"

capture d ecran 2016-11-11 a 00 15 53

When the screen goes mad, ion-content inserts padding-bottom of 434px into that div

capture d ecran 2016-11-11 a 00 16 32

vejja avatar Nov 10 '16 23:11 vejja

@manucorporat There is a very helpful gist by @EvanWillms https://gist.github.com/EvanWillms/8773f8cfa12f469fabf0bdd7a75723e7 I am pretty sure it can help nail down the root cause of the issue.

vejja avatar Nov 11 '16 11:11 vejja

Is there any progress on this issue? I have the same problem, when typing on an input inside a slide the slide is broken

Daskus1 avatar Jan 02 '17 22:01 Daskus1

I've been using <ion-slides> with form inputs for a while now. The problem is that the slider wasn't designed for use with assistive scroll.

I have a workaround described in #10258. It involves making the slider ion-fixed and using <ion-content> inside each <ion-slide>.

The one caveat is that <ion-content> also wasn't designed to deal with multiple content elements on a page. There's a patch in the linked issue that you'll want to call on your ViewController when you create your component.

hotforfeature avatar Feb 03 '17 17:02 hotforfeature

I'm still facing this issue when I is use input with ion-slide. Is there any solution or any updates

ordova CLI: 6.5.0 Ionic Framework Version: 2.2 Ionic CLI Version: 2.2.1 Ionic App Lib Version: 2.2.0 Ionic App Scripts Version: 1 ios-deploy version: Not inst ios-sim version: Not install OS: Windows 8.1 Node Version: v6.10.0 Xcode version: Not installed

sufiiiyan avatar Apr 07 '17 13:04 sufiiiyan

+1

Cordova CLI: 6.5.0 Ionic Framework Version: 3.1.1 Ionic CLI Version: 2.2.3 Ionic App Lib Version: 2.2.1 Ionic App Scripts Version: 1.3.4 ios-deploy version: Not installed ios-sim version: Not installed OS: Linux 4.10 Node Version: v5.12.0 Xcode version: Not installed

pablozandona avatar May 11 '17 15:05 pablozandona

This workaround worked for me in app.modules.ts:

imports...

@NgModule({

	declarations: [
		...
	],

        imports: [
		IonicModule.forRoot(MyApp, {
			scrollAssist: false
		}),
		...
	],

Source: https://forum.ionicframework.com/t/disable-scroll-ionic2-ios9-not-working/44847/9

douglasmoraisdev avatar Nov 06 '17 16:11 douglasmoraisdev

I am facing this issue in android case. Any solution for it.

krunal9421 avatar Nov 23 '17 03:11 krunal9421

Hello i'm facing the same issue. Any update?

aymehri avatar Dec 03 '17 11:12 aymehri