vue-flow: πŸ› [BUG]: Sometimes nodeClick does not emit

Is there an existing issue for this?

  • I have searched the existing issues and this is a new bug.

Current Behavior

Sometimes the nodeClick event is not emitted when a node is clicked. If the node is clicked again, the nodeClick event is emitted this time. After that, the nodeClick event is always emitted at the same mouse coordinates. However, if the mouse coordinates are changed and then clicked, the event may not be emitted.

The rate of reproduction is not so low, if not frequent.

Expected Behavior

Every click should always emit a nodeClick.

Steps To Reproduce

Code

I have created a minimal code. Everything is in App.vue. https://stackblitz.com/edit/vitejs-vite-jw9kpv?file=src%2FApp.vue&terminal=dev

I just created one node and placed it. I have bound @node-click="onNodeClick". Each time a node is clicked, it toggles the border display so that it is easy to see that onNodeClick() has been called. The node information is also displayed in Developer Tools.

Video

We have created a video. The very first click occurs suddenly. The color of the border does not change after clicking. The node information is not displayed even when the Developer Tools is open. In other words, the onNodeClick() call itself is not made. After that, the border color changes, but it reproduces eventually.

https://github.com/bcakmakoglu/vue-flow/assets/1102138/19bb4e56-ec89-491d-92d5-71c679f5514a

Relevant log output

No response

Anything else?

  • @vue-flow/core v1.38.2
  • vue v3.4.31
  • macOS, Chrome, Firefox, Safari

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 34 (20 by maintainers)

Most upvoted comments

From what I can tell the problem is pretty much what I described: The mouse movement you do triggers an unwanted onNodeDrag event which cancels out onNodeClick (this is intentional and not a bug) but when the node is not moved enough to actually move the node visibly, meaning that the distance the node was dragged is smaller than the nodeDragThreshold property (by default 1) the onNodeClick event is still cancelled, which makes it appear like the node click is just not registered.

This will be fixed in the next patch version.

Thank you for reporting this issue and your patience πŸ˜ƒ

Have I said words to you that could be perceived as disrespectful! I am truly sorry about that.

I am Japanese and do not understand complex English at all. I was using both Google Translate and DeepL to translate Japanese and English to each other to check what I was saying. I had communicated with English speakers in the same way before, so I did not think it was a problem, but perhaps there were times when I was rude…

I am very sorry to have offended you. I rather thought I was speaking respectfully to you. Thank you for providing a useful library.

let me investigate this

Yes. Thank you! I will proceed with other work for a while πŸ‘¨πŸ»β€πŸ’».