From 761a4b3ee8b5d7e53165f1f359a02ef68d866ea8 Mon Sep 17 00:00:00 2001 From: prozolic <42107886+prozolic@users.noreply.github.com> Date: Tue, 17 Mar 2026 11:39:38 +0900 Subject: [PATCH] Fix floating toc max height process. --- src/PRDigest.NET/HtmlGenerator.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/PRDigest.NET/HtmlGenerator.cs b/src/PRDigest.NET/HtmlGenerator.cs index fc62dfd..b3c945f 100644 --- a/src/PRDigest.NET/HtmlGenerator.cs +++ b/src/PRDigest.NET/HtmlGenerator.cs @@ -465,7 +465,13 @@ function alignTocToContent() { // Sync top with .content's visible top, clamped to stay inside viewport var top = Math.max(0, rect.top); toc.style.top = top + 'px'; - toc.style.maxHeight = 'calc(100vh - ' + top + 'px)'; + + // Constrain maxHeight so the TOC does not overlap the footer + var footer = document.querySelector('footer'); + var footerRect = footer.getBoundingClientRect(); + var gap = footerRect.top - rect.bottom; + var bottomBound = footer ? Math.min(window.innerHeight, footerRect.top - gap) : window.innerHeight; + toc.style.maxHeight = Math.max(100, bottomBound - top) + 'px'; // Left edge: only on wide screens where the sidebar is shown if (window.innerWidth >= 1600) {