Fixed sidebar auto-positioning (9.4.2 regression)

This commit is contained in:
squidfunk 2023-10-10 10:24:59 +02:00
parent 53749f2acc
commit 5824c6ca4e
No known key found for this signature in database
GPG Key ID: 5ED40BC4F9C436DF
4 changed files with 13 additions and 11 deletions

View File

@ -249,7 +249,7 @@
</script> </script>
{% endblock %} {% endblock %}
{% block scripts %} {% block scripts %}
<script src="{{ 'assets/javascripts/bundle.94c44541.min.js' | url }}"></script> <script src="{{ 'assets/javascripts/bundle.640d63c8.min.js' | url }}"></script>
{% for script in config.extra_javascript %} {% for script in config.extra_javascript %}
{{ script | script_tag }} {{ script | script_tag }}
{% endfor %} {% endfor %}

View File

@ -188,7 +188,9 @@ export function mountSidebar(
next$.pipe(first()) next$.pipe(first())
.subscribe(() => { .subscribe(() => {
for (const item of getElements(".md-nav__link--active[href]", el)) { for (const item of getElements(".md-nav__link--active[href]", el)) {
const container = getElementContainer(item) if (!item.clientHeight) // skip invisible toc in left sidebar
continue
const container = item.closest<HTMLElement>(".md-sidebar__scrollwrap")!
if (typeof container !== "undefined") { if (typeof container !== "undefined") {
const offset = item.offsetTop - container.offsetTop const offset = item.offsetTop - container.offsetTop
const { height } = getElementSize(container) const { height } = getElementSize(container)