From 16dd72b6246ec98fff4cfecc86d31b10f9eea59d Mon Sep 17 00:00:00 2001 From: Jon Seager Date: Tue, 3 Feb 2026 13:29:46 +0000 Subject: [PATCH] fix(timeline): restore sticky month headers and jump-to-top button Remove wrapper div around month headings so the h2 is a direct child of the timeline container. position: sticky was broken because the heading's containing block (the wrapper) was only as tall as the heading itself, giving it no room to stick. Also update MutationObserver to detect headings added as direct children via node.matches() in addition to node.querySelector(). --- templates/partials/timeline_month.html | 18 ++++++++---------- templates/timeline.html | 3 +++ 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/templates/partials/timeline_month.html b/templates/partials/timeline_month.html index 96fe4cd..e241cbc 100644 --- a/templates/partials/timeline_month.html +++ b/templates/partials/timeline_month.html @@ -1,13 +1,11 @@ -
-

- {{ month.heading }} - -

-
+

+ {{ month.heading }} + +

{% for event in month.events %}
{# Timeline node/bullet #} diff --git a/templates/timeline.html b/templates/timeline.html index 365c2a2..0dfb4bc 100644 --- a/templates/timeline.html +++ b/templates/timeline.html @@ -201,6 +201,9 @@ mutations.forEach((mutation) => { mutation.addedNodes.forEach((node) => { if (node.nodeType === Node.ELEMENT_NODE) { + if (node.matches?.(".timeline-heading")) { + stickyObserver.observe(node) + } const heading = node.querySelector?.(".timeline-heading") if (heading) { stickyObserver.observe(heading)