plotly / angular-plotly.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The (plotly_click) output is not triggered when using mobile device

dmitriy-viniukov opened this issue · comments

I am building hybrid app using angular with capacitor. On iphone, when I try to click on data point, the (plotly_click) output is not fired. I tried deprecated (click) and it works.

@andrefarzat Could you please take a look?

Hello @dmitriy-viniukov. I never tried angular-plotly.js with capacitor, but I believe this might be an issue with plotly click event not being triggered by the click/tap?

My first doubt is: are you trying the click event on the mobile (thus, the ontoutchstart event) or using on the browser (thus, the onclick event)?

@andrefarzat Thanks for fast response!

So I am trying browser event:

<plotly-plot (click)="onClick()" (plotly_click)="onPlotlyClick()"> </plotly-plot>

onClick() {
  console.log('click');
}

onPlotlyClick() {
  console.log('plotly click');
}

In console I see 'click' twice when tapping on data point on mobile.
I have just noticed that the issue is not only with capacitor. If I try to do the same with my application on mobile browser, (plotly_click) doesn't work as well. So the issue might be just with mobile interactions.

Thanks in advance

@andrefarzat small update: seems like the issue relates to Safari browser. (plotly_click) does not work there. Chrome is fine

@dmitriy-viniukov this confirm what I was supposing: The plotly.js itself isn't triggering the plotly_click, thus angular-plotly.js can't trigger the (plotly_click) also. It's curious for why this doesn't work in safari ( blink and webkit aren't that different ). Have you tried in the other browsers' engine (e.g.: firefox, IE ?)

@andrefarzat I have just tried in firefox and it does not work as well

@andrefarzat So should I create a topic in plotly.js repo with that issue or it is something that you can fix from your side?

@dmitriy-viniukov it's good to open an issue there. I made a search on the previous issues and looks like mobile isn't 100% supported: plotly/plotly.js#1858

I dunno if tap events are converted to click events, for example