-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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 a link only works directly on the node text #891
Comments
Could you please reproduce the issue in https://mermaidjs.github.io/mermaid-live-editor/ and post a link back here? In my testing I am not seeing a big distinction between when the hover happens for the link/action |
Hi @jgreywolf, I have provided a minimal example here: My point is that you should be able to click on the node on any position to open the URL, but that does only happen when you click on the link directly. But I don't mind if this is considered as the expected behaviour. If so, we might as well close the issue. |
I agreed with that, so I left it as a bug. If not, we'll move it over to "enhancement". |
Thanks @GDFaber When I tried to reproduce with a rectangle there was hardly any space left over to see the issue :) |
After further investigation I am not 100% sure if this is something that can be addressed within mermaid - or at least not as just a bug?. If I am following the code correctly, when an href link is found it is added to the object as a property called What I am not finding is a good place to add the action to a parent element of the resulting DOM element From what I can tell, if the action is a callback it follows a different path, and the eventListener is added to the entire shape so it should operate as expected. Im not sure how to add a script to handle a callback in the live editor though, so not able to test there for sure. Im not sure how to continue right now. |
@jgreywolf I'm thinking about this from a different perspective and I might be completely wrong but here it goes: |
No, that is what I was thinking as well, I just have not been successful in making that happen. When the click event is just a link the url is added to the object, and at render time a svg link element is generated, the shape text is added as a child of the Basically, from what I can tell, these aren't added into the DOM until after D3 renders the SVG element... |
Just for the record I leave my workaround here, maybe it can be improved or turned into something similar to be worth integrating.
I do this after rendering, "#flowchart" is my rendering container (I'm only using flowcharts at the moment). |
I'm currently working on a PR for this. |
Describe current behaviour
When an URL click event is defined for a flowchart node, it is only called when the node text is clicked. Clicking anywhere else in the node does not trigger the click event. The mouse pointer suggests that the node could be clicked at any position though.
To Reproduce
This can be reproduced using the interaction example at http://knsv.github.io/mermaid/#/flowchart?id=interaction
Expected behavior
Link/function should be called no matter what position a user has clicked on the node.
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: