In this scenario, from time to time (not always), both events will fire, even though tap and press are supposed to be mutually exclusive gestures — I’d obviously prefer them to be exclusive so that I don’t have two completely different user interactions firing off at the same time from the same user input.
Not only this, but sometimes a definitive (very brief) tap will cause a press event to fire instead.
This seems to occur more on older, slower, Android devices, but it could just be my imagination.
I recently struggled with the (tap), (press) and (click) events and changed all my (tap) events into (click) since things were firing twice. Dit you tried calling
e.preventDefault();
after the event handler to prevent the events from falling down?
Thanks. I have read those articles, though I gather tap and press are still supposed to work together without ever touching the $event object. I’ve tried several variations of event.preventDefault() and event.stopPropagation().
can anyone tell how can i increase and decrease tap value for individual product.
here is my code.
<ion-item *ngFor=“let item of product; let i = index”>
{{ item.product_name}}
{{ item.product_desc}}
<button item-end ion-button small (tap)="tapEventsub(i)">-</button>
<p item-end> {{tap}} </p>
<button item-end ion-button small (tap)="tapEventadd(i)">+</button>
<button ion-button item-end small round>Add</button>
</ion-item>
The tap and press events aren’t the same object that other PointerEvents use and, as you pointed out, don’t include the stopPropagation() method. The click event still occurs after a press or a tap, so I found that I could stop propagation on that to keep from clicking on the parent object:
<button ion-button
(tap)="deletePrivateDiscussion(discussionItem)"
(click)="$event.stopPropagation()"
color="danger" small [hidden]="hideDeleteButtons">