diff --git a/source/_includes/site/sidebar.html b/source/_includes/site/sidebar.html
index e3372e5f76c..375d78fd713 100644
--- a/source/_includes/site/sidebar.html
+++ b/source/_includes/site/sidebar.html
@@ -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"
}
}