Ionic-framework: Alert input autofocus keyboard shows and then goes back to hiding again on item tap.

Created on 3 Aug 2017  路  5Comments  路  Source: ionic-team/ionic-framework

1

Ionic version: (check one with "x")
[ ] 1.x (For Ionic 1.x issues, please use https://github.com/ionic-team/ionic-v1)
[x ] 2.x
[ ] 3.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:
Alert input autofocus keyboard not working properly on item tap. It shows up like 30% and then it hides again.

Expected behavior:
Alert input autofocus used to work properly before I updated my ionic version.

Related code:

<ion-item
    (tap)="showPromptNumber(player)">
    ......
</ion-item>
showPromptNumber(player: Player) {
    const number = (player.number == 0) ? '': player.number
    this.alertController.create({
      title: 'Edit Panel Number',
      message: `Enter the number for ${player.first_name} ${player.last_name}`,
      inputs: [{
        name: 'number',
        value: `${number}`,
        placeholder: 'Panel Number',
        type: 'tel'
      }],
      buttons: [....]
    }).present();
}

Other information:

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

cli packages: (/Users/administrator/development/sportsinfocus-mobile-app/node_modules)

@ionic/cli-plugin-cordova       : 1.6.1
@ionic/cli-plugin-ionic-angular : 1.4.1
@ionic/cli-utils                : 1.7.0
ionic (Ionic CLI)               : 3.7.0

global packages:

Cordova CLI : 7.0.1

local packages:

@ionic/app-scripts : 2.0.2
Cordova Platforms  : ios
Ionic Framework    : ionic-angular 3.5.3

System:

Node  : v6.11.1
OS    : macOS Sierra
Xcode : Xcode 8.2.1 Build version 8C1002
npm   : 3.10.10

Most helpful comment

well. didn't know there was this option. now working.

this.alertController.create(
...
)
.present({
    keyboardClose: false
});

All 5 comments

Only issue I have is the on item tap, the keyboard shows halfway and then goes back to hiding. When tapping the input though, it works properly (the .gif just shows it a bit awkward, but works properly).

I remembered adding this preference tag on my config.xml file before.

<preference name="KeyboardDisplayRequiresUserAction" value="false" />

This made the autofocus worked before.

well. didn't know there was this option. now working.

this.alertController.create(
...
)
.present({
    keyboardClose: false
});

Nice! This worked for me too.

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

brandyscarney picture brandyscarney  路  3Comments

giammaleoni picture giammaleoni  路  3Comments

alexbainbridge picture alexbainbridge  路  3Comments

BilelKrichen picture BilelKrichen  路  3Comments

alan-agius4 picture alan-agius4  路  3Comments