ionic-team / ionic-framework

A powerful cross-platform UI toolkit for building native-quality iOS, Android, and Progressive Web Apps with HTML, CSS, and JavaScript.
https://ionicframework.com
MIT License
51.03k stars 13.51k forks source link

bug: AlertController button clicks trigger behind ion-item #21515

Closed florian72810 closed 4 years ago

florian72810 commented 4 years ago

Bug Report

Ionic version: [x] 5.x

Current behavior: When tapping a button on an AlertController element, the ion-item behind is also triggered.

It happens

The bug looks a lot like #9884.

Expected behavior: The ion-item behind a AlertController button should not be tapped.

Steps to reproduce:

use starter-template tabs and add related code OR use this repo: https://github.com/florian72810/ionic-starter-tabs-alertcontroller-trigger-ion-item

Related code:

  <ion-list>
    <ion-item *ngFor="let item of [1,2,3,4,5,6,7,8,9]" (click)="open('Alert '+item)">
      <ion-icon slot="start" name="sync"></ion-icon>
      <ion-label>
        <h2>Titre {{item}}</h2>
        <p>Contenu</p>
      </ion-label>
    </ion-item>
  </ion-list>
  async open(content: string) {
    const alert = await this.alertController.create({
      cssClass: 'my-custom-class',
      header: content,
      subHeader: 'Subtitle',
      message: 'This is an alert message.',
      buttons: ['OK']
    });

    await alert.present();
  }

Other information:

Ionic info:

Ionic:

   Ionic CLI                     : 6.10.0 (/usr/local/lib/node_modules/@ionic/cli)
   Ionic Framework               : @ionic/angular 5.2.1
   @angular-devkit/build-angular : 0.901.8
   @angular-devkit/schematics    : 9.1.8
   @angular/cli                  : 9.1.8
   @ionic/angular-toolkit        : 2.2.0

Cordova:

   Cordova CLI       : 8.1.2 (cordova-lib@8.1.1)
   Cordova Platforms : ios 5.1.1
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 4 other plugins)

Utility:

   cordova-res (update available: 0.14.0) : 0.8.1
   native-run (update available: 1.0.0)   : 0.3.0

System:

   ios-deploy : 1.9.4
   ios-sim    : 8.0.2
   NodeJS     : v12.12.0 (/usr/local/Cellar/node/12.12.0/bin/node)
   npm        : 6.14.5
   OS         : macOS Catalina
   Xcode      : Xcode 11.5 Build version 11E608c
liamdebeasi commented 4 years ago

Thanks for the issue. I am going to close this as a duplicate of https://github.com/ionic-team/ionic/issues/21503.

ionitron-bot[bot] commented 4 years ago

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.