-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Compiler version
3.3.3
Minimized code
filename : js.md
<h1>Hello JS</h1>
<script type="text/javascript">
console.log("boo")
</script>
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 to localhost: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;
- plots (for example benchmarking)
- documenting scalaJS projects
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