The first action is to navigate to the tiddler with the anchor link and then the second action is to scroll the anchor link to view.
The problem is that action-navigate doesn’t end when the tiddler has been loaded and added to the dom (rather, it just adds the tiddler to $:/StoryList so when the wiki is rendered, it will be rendered, that happens later). So when searching for the anchor link (through documet#querySelector), nothing is found and so nothing is scrolled.
Is there a way to run the second action only after the story list has been rendered?
I’d use @EricShulman’s $action-timeout action widget with a suitable delay. It’s not ideal, it’s not synchronous and may “miss” depending on prevailing network conditions. But you can get pretty close to a 99% satisfactory solution.
Hi @Ittayd you may be interested to have a look at TWPub which I worked on last year for @xcazin. It includes an implementation of multiple story rivers, and navigating to anchors within tiddlers.
It implements most of the functionality of the navigator widget entirely in wikitext. To make the scrolling work, I prototyped a new <$historytracker> widget (see the source). After rendering its children, and when the $:/History tiddler changes, it scrolls to the current tiddler.
There’s a lot of code there. I’m happy to answer questions about it, it sounds like you are exploring similar territory
TWPub includes quite a few core customisations that are highly likely to break other plugins and customisations. As you’ve discovered, trying to do navigation in wikitext cannot be done satisfactorily without extensions to the core, so I used TWPub as a testbed for exploring possible approaches. It also includes a lot of code to handle the display of EPUBs that have been converted using a separate tool provided as a Node.js app. So I think you’d be better off picking some techniques from TWPub. I’m happy to discuss the core modifications we need for doing this.