mirror of
https://github.com/snachodog/just-the-docs.git
synced 2025-09-12 21:03:32 -06:00
Fixed: navigation scroll to active link regression (#1367)
* Defer removal of href The `href` with the URL of the current page is inspected by `navLink()`, so it should not be removed until after the calls of `navLink()` in `scrollNav()` and `activateNav()`. As `scrollNav()` follows `activateNav()`, the removal of `href` needs to be left to `scrollNav()`. * Update CHANGELOG.md
This commit is contained in:
@@ -497,6 +497,7 @@ function scrollNav() {
|
||||
if (targetLink) {
|
||||
const rect = targetLink.getBoundingClientRect();
|
||||
document.getElementById('site-nav').scrollBy(0, rect.top - 3*rect.height);
|
||||
targetLink.removeAttribute('href');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -507,7 +508,6 @@ function activateNav() {
|
||||
var target = navLink();
|
||||
if (target) {
|
||||
target.classList.toggle('active', true);
|
||||
target.removeAttribute('href');
|
||||
}
|
||||
while (target) {
|
||||
while (target && !(target.classList && target.classList.contains('nav-list-item'))) {
|
||||
|
Reference in New Issue
Block a user