Skip to content

Commit 7694985

Browse files
authored
Fix: Correct the navigation to anchor (#17910)
The browser compatibility of [`location.hash`](https://developer.mozilla.org/en-US/docs/Web/API/Location/hash) seems to be out of date. That's why in this fix, I suggest using [`history.replaceState`](https://developer.mozilla.org/en-US/docs/Web/API/History/replaceState). ## Before: https://github.com/lampepfl/dotty/assets/44496264/a1399b0b-e4e8-4754-b146-661b59a01824 ## After: https://github.com/lampepfl/dotty/assets/44496264/22f38852-0cc5-48eb-a6e7-699f11628401 Fixes: #17182
1 parent 6071005 commit 7694985

File tree

1 file changed

+1
-1
lines changed
  • scaladoc/resources/dotty_res/scripts

1 file changed

+1
-1
lines changed

scaladoc/resources/dotty_res/scripts/ux.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ document
285285
getTocListElement(id).parentElement.classList.toggle("active");
286286
}
287287
if (lastEntry.isIntersecting) {
288-
window.location.hash = "";
288+
history.replaceState(history.state, "", window.location.pathname + window.location.search);
289289
removeAllHighlights();
290290
const id = getIdOfElement(lastEntry);
291291

0 commit comments

Comments
 (0)