This commit is contained in:
Thomas Sibley 2025-02-20 11:24:36 +01:00 committed by GitHub
commit f19c79a008
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 2 deletions

File diff suppressed because one or more lines are too long

View File

@ -160,7 +160,15 @@ function ThemeNav () {
.addClass('current')
.attr('aria-expanded','true');
}
link[0].scrollIntoView();
/* Scroll the link's top-level parent into view first. Then
* scroll the link itself into view, which will only have an
* effect if the top-level parent is taller than the viewport
* and the link is still outside the viewport after the first
* scroll. (This seems likely to be rare.)
*/
link.closest('li.toctree-l1')[0]
.scrollIntoView({block: "nearest"});
link[0].scrollIntoView({block: "nearest"});
}
}
catch (err) {