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:
parent
7ca4ca1a90
commit
7abeb68708
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -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 %}
|
||||
|
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user