Open Quafadas opened 2 months ago
Thinking about this, if it is a bug, I think it's actually kind of a nasty one because the behaviour isn't obvious and it sucks a lot of time figuring out where the problem really lay.
I think this is the second hour or three spent checking my own stuff before starting to question scaladoc itself, and I ended up lucky to get some heavyweight help finding that loadPageState
function.
Compiler version
3.3.3
Minimized code
filename : js.md
In the "_docs" directory, of a static site, which will be part of a scaladoc static site.
Output
If you generate the site, serve it locally and navigate to the URL inhabited by this file (e.g.
localhost:3000/docs/js.html
), you'll see that the browser console has "boo" printed.If you navigate to a different page on the sidebar (e.g.
localhost:3000/docs/notjs.html
), then navigate tolocalhost:3000/docs/js.html
via the sidebar, no message will be printed. In other words, javascript doesn't fire if you arrive via the internal # routing.This breaks my expectations, and I think it is awkward, because it works "the first time", but not subsequently, which is an awkward user / developer experience.
Expectation
I would expect javascript to run when navigating to the page. It is possible, that this is a legitimate design choice, but it feels odd, because it does work as expected, the first time.
I will note that I think there are legitimate uses for being able to run js on documentation pages. The examples which I'm interested in are;
And I'm sure there are more. I'm reporting this as a bug, perhaps in ignorance - it could be intended behaviour.
Culprit
A discord discussion led us to believe the culprit is this; https://discord.com/channels/632150470000902164/632150470000902166/1288100519029641289