Ionic-framework: [ionic 2] Confirmation Alert: no way to define default button invoked on hardware keyboard ENTER press

Created on 27 Jan 2017  路  4Comments  路  Source: ionic-team/ionic-framework

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

I'm submitting a ... (check one with "x")
[ ] bug report
[ x] 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 I create the Alert object, there is no posibility to define a default button, which can be invoked on the hardware keyboard ENTER press.

Expected behavior:
I expect that I can define default button which invoked on hardware keyboard ENTER press.

Steps to reproduce:

  1. Open http://ionicframework.com/docs/v2/components/#alert-confirm
  2. Press "SHOW CONFIRM ALERT".
  3. Press ENTER, the handler of the first button is fired, but the first button is disargree.

Related code:

import { AlertController } from 'ionic-angular';

export class MyPage {
  constructor(public alertCtrl: AlertController) {
  }

  showConfirm() {
    let confirm = this.alertCtrl.create({
      title: 'Use this lightsaber?',
      message: 'Do you agree to use this lightsaber to do good across the intergalactic galaxy?',
      buttons: [
        {
          text: 'Disagree',
          handler: () => {
            console.log('Disagree clicked');
          }
        },
        {
          text: 'Agree',
          handler: () => {
            console.log('Agree clicked');
          }
        }
      ]
    });
    confirm.present();
  }
}

Other information:

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

Cordova 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: 1.0.0
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v6.9.1
Xcode version: Not installed

Most helpful comment

@jgw96 Feature request links seems to broken, would be nice to see this feature added for PWA

All 4 comments

Hello! Thanks for the feature request. I'm going to move this issue over to our internal list of feature requests for evaluation. We are continually prioritizing all requests that we receive with outstanding issues. We are extremely grateful for your feedback, but it may not always be our next priority. I'll copy the issue back to this repository when we have begun implementation. Thanks!

This issue was moved to driftyco/ionic-feature-requests#117

@jgw96 Feature request links seems to broken, would be nice to see this feature added for PWA

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

daveshirman picture daveshirman  路  3Comments

giammaleoni picture giammaleoni  路  3Comments

Nick-The-Uncharted picture Nick-The-Uncharted  路  3Comments

GeorgeAnanthSoosai picture GeorgeAnanthSoosai  路  3Comments

fdnhkj picture fdnhkj  路  3Comments