From da5abf042ef84cb32848abb2c03d3385b7974fa4 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Sat, 23 May 2026 11:08:03 +0000 Subject: [PATCH] Preserve explicit carousel tab selections Co-authored-by: pa7ch3s --- index.html | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 62f6e91..296bb19 100644 --- a/index.html +++ b/index.html @@ -191,6 +191,22 @@

Contact

var reduceMotion = window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches; var scrollDebounce = null; var lastScrollIndex = -1; + var programmaticScrollIndex = null; + var programmaticScrollTimer = null; + + function clearProgrammaticScroll() { + programmaticScrollIndex = null; + if (programmaticScrollTimer) { + clearTimeout(programmaticScrollTimer); + programmaticScrollTimer = null; + } + } + + function markProgrammaticScroll(index) { + programmaticScrollIndex = index; + if (programmaticScrollTimer) clearTimeout(programmaticScrollTimer); + programmaticScrollTimer = window.setTimeout(clearProgrammaticScroll, 1000); + } function indexFromCenter() { if (!carousel) return 0; @@ -251,6 +267,7 @@

Contact

} if (!fromScroll) { + markProgrammaticScroll(index); scrollTabToCenter(index); } @@ -264,6 +281,10 @@

Contact

if (scrollDebounce) clearTimeout(scrollDebounce); scrollDebounce = setTimeout(function () { scrollDebounce = null; + if (programmaticScrollIndex !== null) { + clearProgrammaticScroll(); + return; + } var idx = indexFromCenter(); if (idx === lastScrollIndex) return; setActive(idx, false, true); @@ -314,7 +335,7 @@

Contact

tabs.forEach(function (t, i) { if (t.classList.contains('is-active')) initialIndex = i; }); - setActive(initialIndex, false, false); + setActive(initialIndex, false, true); })();