mirror of
https://github.com/snachodog/just-the-docs.git
synced 2025-04-16 16:12:23 -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:
parent
3d01bc9183
commit
ae52352eae
@ -26,6 +26,7 @@ Code changes to `main` that are *not* in the latest release:
|
|||||||
- Fixed: remove href from the navigation link to the current page by [@pdmosses] in [#1356]
|
- Fixed: remove href from the navigation link to the current page by [@pdmosses] in [#1356]
|
||||||
- Fixed: improve build time by [@pdmosses] in [#1358]
|
- Fixed: improve build time by [@pdmosses] in [#1358]
|
||||||
- Fixed: erroneous parentheses in `site_nav` conditional by [@mattxwang] in [#1366]
|
- Fixed: erroneous parentheses in `site_nav` conditional by [@mattxwang] in [#1366]
|
||||||
|
- Fixed: navigation scroll to active link regression by [@pdmosses] in [#1367]
|
||||||
|
|
||||||
{: .warning }
|
{: .warning }
|
||||||
[#1358] moved `_includes/nav.html` to the `_includes/components` directory,
|
[#1358] moved `_includes/nav.html` to the `_includes/components` directory,
|
||||||
@ -41,6 +42,7 @@ Users who were overriding that file will need to adjust their sites accordingly.
|
|||||||
[#1358]: https://github.com/just-the-docs/just-the-docs/pull/1358
|
[#1358]: https://github.com/just-the-docs/just-the-docs/pull/1358
|
||||||
[#1360]: https://github.com/just-the-docs/just-the-docs/pull/1360
|
[#1360]: https://github.com/just-the-docs/just-the-docs/pull/1360
|
||||||
[#1366]: https://github.com/just-the-docs/just-the-docs/pull/1366
|
[#1366]: https://github.com/just-the-docs/just-the-docs/pull/1366
|
||||||
|
[#1367]: https://github.com/just-the-docs/just-the-docs/pull/1367
|
||||||
|
|
||||||
## Release v0.6.2
|
## Release v0.6.2
|
||||||
|
|
||||||
|
@ -497,6 +497,7 @@ function scrollNav() {
|
|||||||
if (targetLink) {
|
if (targetLink) {
|
||||||
const rect = targetLink.getBoundingClientRect();
|
const rect = targetLink.getBoundingClientRect();
|
||||||
document.getElementById('site-nav').scrollBy(0, rect.top - 3*rect.height);
|
document.getElementById('site-nav').scrollBy(0, rect.top - 3*rect.height);
|
||||||
|
targetLink.removeAttribute('href');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -507,7 +508,6 @@ function activateNav() {
|
|||||||
var target = navLink();
|
var target = navLink();
|
||||||
if (target) {
|
if (target) {
|
||||||
target.classList.toggle('active', true);
|
target.classList.toggle('active', true);
|
||||||
target.removeAttribute('href');
|
|
||||||
}
|
}
|
||||||
while (target) {
|
while (target) {
|
||||||
while (target && !(target.classList && target.classList.contains('nav-list-item'))) {
|
while (target && !(target.classList && target.classList.contains('nav-list-item'))) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user