Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS fires both "click" and "press" events from a long press #10306

Closed
davidfischer opened this issue Feb 3, 2017 · 3 comments
Closed

iOS fires both "click" and "press" events from a long press #10306

davidfischer opened this issue Feb 3, 2017 · 3 comments

Comments

@davidfischer
Copy link

Ionic version: (check one with "x")
[ ] 1.x
[x] 2.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:
When an element has both a "click" and "press" event listener, it seems like both events are fired from a long press on iOS. On Android, it seems the click event is fired from a short click and the press event is fired from a long press. This latter functionality seems correct to me.

Interestingly enough, on a short click, iOS does not fire the "press" event. Only on a long press does iOS fire both events.

Expected behavior:
iOS should function as Android does. iOS should not fire both a "click" and a "press" event from a long press.

Steps to reproduce:
This is example code but running it on the web functions correctly. I only see this issue on an iOS device or emulator. In the below example, open the console and try clicking or long pressing on the "address".
http://plnkr.co/edit/wQvVzysxsojTpWkAiJeO?p=preview

Related code:

<ion-item (click)="openMapApp()" (press)="copyAddress()" no-padding full-lines text-wrap text-center detail-push>{{ address}}</ion-item>

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

Your system information:

Cordova CLI: 6.5.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: 1.8.4
ios-sim version: 5.0.4
OS: macOS Sierra
Node Version: v6.9.4
Xcode version: Xcode 8.2.1 Build version 8C1002
@tushar-velingkar
Copy link

If making mobile apps, (tap) might be better. This is because when using (click) the action always executes, even when tapping accidently. The (tap) won't execute if the user holds it for a longer period. And if you want to have a button that needs to be clicked for a longer period of time you can use the (press).
http://stackoverflow.com/a/39632430

@Traksewt
Copy link

Traksewt commented May 4, 2017

From the above description, it sounds like iOS is correct as click is always fired and tap and press are mutually exclusive. So we need click to fire on long presses on Android to be consistent. I found the original link here http://stackoverflow.com/questions/39628718/ionic2-tap-vs-click/39632430

@ionitron-bot
Copy link

ionitron-bot bot commented May 5, 2018

Thanks for the issue! This issue is being closed due to inactivity. 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.

Thank you for using Ionic!

@ionitron-bot ionitron-bot bot closed this as completed May 5, 2018
@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators May 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants