Anchors can only be visited once consecutively

I discovered some months ago that anchors in embedded svg can only be visited once. I have many such links in my SVG that take this form

 <a
   xlink:href="smith.htm#John%20Smith"

I have tried to implement the work around in discussion Anchors can be used once , that took place in June 2022 but do not have enough knowledge to make it work. I probably have more than a hundred such links within the SVG.
Can anyone help me to make this work?

Peter

1 Like

I addressed this in the context of mermaid.js diagrams which are generated svg.

https://talk.tiddlywiki.org/t/dynamically-generating-mermaid-diagrams/7069

The eventcacher widget’s selector is the key. You have to inspect the svg, which I assume was generated, to figure out how to select the element with the href value. In my case, I had to select the tag that has a child node with the class “node” (in css selector syntax it’s specified as “a:has(.node)”). That href value should be the tiddler title (Not the url of the wiki plus an anchor) because it will get passed directly to the action-navigate widget.

Hope that makes sense and helps.

Thank you for your response. At the moment this is beyond my capabilities. I will need to study HTML, CSS and js handling of DOM events first, according to the tw introduction to the eventcatcherwidget.
I expect I will be able to use your advice then.
I do thank you for your response and I will let you know how it works out for me.

Peter

So, does anyone have a clue how I can achieve this workaround succesfully within Click-actions with the anchor type that I have shown - I have seen removesuffix and remove prefix but this would not help. Is there anything that will allow this to work, is there some other way to make the browser respond or is it not possible?

The ability for arbitrary HTML code to tap into TiddlyWiki’s navigation mechanism by navigating to location hashes is extremely useful.

The issue of the inability to repeat navigation to the tiddler that was last navigated can be frustrating. One solution might be for TiddlyWiki to reset the location hash after completing a navigation initiated by a change to the location hash. But it would interfere with the ability to share the current browser address to share the current tiddler: one normally expects to be able to navigate to a link and then share it onwards with the recipient seeing the same content that you saw. This needs some investigation.

1 Like