ionic-team/ionic-framework

bug: tap click cancels gesture when used on button

オープン

#22,491 opened on 2020/11/12

 (15 件のコメント) (1 件のリアクション) (0 人の担当者)TypeScript (13,381 件のフォーク)batch import
help wantedpackage: coretype: bug

Repository metrics

Stars
 (52,503 個のスター)
PR merge metrics
 (PR metrics pending)

説明

Bug Report

Ionic version: [x] 5.x (5.4.4)

Current behavior: If the GesturesController is used on an Ionic button. The ripple-effect does not work anymore.

Expected behavior: The ripple-effect should work in this case.

Steps to reproduce: In my case: Create a directive with the Ionic GesturesController and assign it to a ion-button or ion-fab-button.

Related code:

import { GestureController } from "@ionic/angular";
/* ... */
constructor (private gestureCtrl: GestureController) {}
/* ... */
  this.gestureCtrl.create({
      gestureName: "long-press",
      el: this.nativeElement,
      threshold: 0,
      onStart: detail => {
        console.log("onStart", detail);
        this.onStart.emit(detail.event);
      },
      onEnd: detail => {
        console.log("onEnd", detail);
        this.onEnd.emit(detail.event);
      }
    });
  <ion-fab-button
    long-press
    (onStart)="log('fab:onStart')"
    (onEnd)="log('fab:onEnd')"
  >
    <ion-icon name="bug"></ion-icon>
  </ion-fab-button>

Stackblitz Demo

gestures-ripple-issue

Other information:

I guess it's about event propagation. The ripple effects does not get any clicks. But how to fix this? I already tested some options like passive.

https://ionicframework.com/docs/utilities/gestures

コントリビューターガイド