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

Clicking on source or target elements on mobile devices is not working #83

Open
hellovietduc opened this issue Oct 13, 2022 · 7 comments

Comments

@hellovietduc
Copy link

When using the latest jsplumb version, clicking on a source or a target element doesn't work. This only occurs on mobile devices (does not happen when resizing the browser window on desktop to a small size). I tried attaching a global click listener to the document object and log the event.target but the listener doesn't trigger whenever I click on the elements. All click listeners in child elements also don't work.


Summary: Existing click event is not fired from node element and its child elements
Affected version: 5.12.x
Affected devices: iOS and Android

@sporritt
Copy link
Member

how are you binding to the click event?

@hellovietduc
Copy link
Author

We're using Vue.js. The structure is something like this:

<div id="post-123">
  ...
  <button @click="handleClick">Like</button>
  ...
</div>

<div id="post-224">
  ...
  <button @click="handleClick">Like</button>
  ...
</div>

Then in a mixin, we connect the two elements together.

const fromElement = document.getElementById('post-123')
const toElement = document.getElementById('post-224')

jsPlumb.connect({
  source: fromElement,
  target: toElement,
  ...
})

When on a browser on a mobile device, the handleClick function is not called anymore because click is never emitted.

@hellovietduc
Copy link
Author

I can actually reproduce this by going to https://jsplumbtoolkit.com/community on Xcode Simulator, and then use Safari DevTools to inspect the HTML and attach a listener to one of the node, then click on it. The code is not run. Doing the same thing on desktop, the listener runs.

@sporritt
Copy link
Member

have you tested on any browser other than Safari?

@hellovietduc
Copy link
Author

Yes. It also happens in Chrome.

@sporritt
Copy link
Member

does it happen on this page for you in Chrome?

https://demo.jsplumbtoolkit.com/community/flowchart/

@hellovietduc
Copy link
Author

yes it happens. I plugged an Android phone to my laptop and used Chrome Inspect (chrome://inspect/#devices), then I selected the element and attached the listener like below:

$0.addEventListener('click', ()=>{alert('hello')})

The alert never comes.

I also added a global listener

document.addEventListener('click', ()=>{alert('hello')})

and the alert shows when I click everywhere except the node element:

image

@sporritt sporritt transferred this issue from jsplumb/jsplumb Oct 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants