Closed KacperFKorban closed 1 year ago
Hello, from what I noticed during my test, the problem comes from the fact that the anchor does not remain in the URL. After some research, I found this javascript that replaces the anchor with an empty string.
In scaladoc/resources/dotty_res/scripts/ux.js
:
if (lastEntry.isIntersecting) {
window.location.hash = "";
removeAllHighlights();
const id = getIdOfElement(lastEntry);
getTocListElement(id).parentElement.classList.toggle("active");
}
So from what I see, this if
statement checks if the last entry in entries is intersecting with the window, indicating that it is visible on the screen. If that's the case, the code performs the following actions:
It resets the window's anchor.
It calls the removeAllHighlights function to remove any existing highlights from the table of contents elements and put the element where we are in active
So I know what the purpose of this if
is but when I delete it, I don't see any change (and it works better).
https://github.com/lampepfl/dotty/assets/44496264/69160bd2-ffe5-4cf0-b9f2-97c859fe185a
https://github.com/lampepfl/dotty/assets/44496264/a9ccdf11-e523-4659-a097-dd11d8ddfaaf
The issue is not present on Firefox.
@KacperFKorban Which browser do you use? On my Firefox I can’t reproduce the issue.
@julienrf I use Chrome. I see that the issue is reproducible, based on the previous comment.
@Florian3k Can you take a look at @Dedelweiss suggestion?
Compiler version
main
Description
In some cases, scaladoc can't properly scroll to anchors that are on the same page. In those cases, it takes several tries for scaladoc to scroll the entire way. e.g.
Expectation
Scaladoc should always be able to scroll to anchors.