Fix sidebar footer overlap (#16181)

This commit is contained in:
Tom Brien 2021-01-25 14:55:55 +00:00 committed by GitHub
parent 87c121ec1c
commit ed301346b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,10 +36,11 @@
// Some sidebars are longer than the screen so they can't be locked.
document.addEventListener('DOMContentLoaded', function() {
const sidebar = document.querySelector("#sidebar").querySelector(".grid");
const footer = document.querySelector("footer").querySelector(".grid")
if (sidebar) {
const content = document.querySelector(".page-content").querySelector(".grid-wrapper");
const windowHeight = window.innerHeight - 82;
if (sidebar.clientHeight > content.clientHeight || sidebar.clientHeight > windowHeight) {
if (sidebar.clientHeight > content.clientHeight || sidebar.clientHeight > windowHeight - footer.clientHeight) {
sidebar.style.display = "contents"
}
}