1
0
mirror of https://github.com/squidfunk/mkdocs-material.git synced 2024-11-28 01:10:58 +01:00

Fixed rendering of back-to-top button when used with sticky tabs

This commit is contained in:
squidfunk 2021-07-10 11:03:23 +02:00
parent 7ca4ca1a90
commit 7abeb68708
4 changed files with 14 additions and 12 deletions

View File

@ -223,7 +223,7 @@
</script>
{% endblock %}
{% block scripts %}
<script src="{{ 'assets/javascripts/bundle.8400c76f.min.js' | url }}"></script>
<script src="{{ 'assets/javascripts/bundle.d7b0ad22.min.js' | url }}"></script>
{% for path in config["extra_javascript"] %}
<script src="{{ path | url }}"></script>
{% endfor %}

View File

@ -43,7 +43,7 @@ import {
setBackToTopOffset,
setBackToTopState
} from "~/actions"
import { Viewport } from "~/browser"
import { Viewport, setElementFocus } from "~/browser"
import { Component } from "../_"
import { Header } from "../header"
@ -103,7 +103,7 @@ export function watchBackToTop(
.pipe(
map(({ offset: { y } }) => y),
bufferCount(2, 1),
map(([a, b]) => a > b),
map(([a, b]) => a > b && b),
distinctUntilChanged()
)
@ -153,10 +153,12 @@ export function mountBackToTop(
/* Update state */
next([{ hidden }, { height }]) {
setBackToTopOffset(el, height + 16)
if (hidden)
if (hidden) {
setBackToTopState(el, "hidden")
else
setElementFocus(el, false)
} else {
resetBackToTopState(el)
}
},
/* Reset on complete */