From 371af1f7e599be91f61c17799d28688f03e3312f Mon Sep 17 00:00:00 2001 From: FrankZamora Date: Sat, 29 Nov 2025 11:19:30 -0600 Subject: [PATCH] feat(toc): auto-scroll del sidebar al elemento activo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cuando el ScrollSpy detecta un nuevo heading activo, el TOC sidebar ahora hace scroll automático para mostrar el elemento activo usando scrollIntoView con behavior: smooth y block: nearest. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../Infrastructure/Ui/TableOfContentsRenderer.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Public/TableOfContents/Infrastructure/Ui/TableOfContentsRenderer.php b/Public/TableOfContents/Infrastructure/Ui/TableOfContentsRenderer.php index 9cdf5765..16139b22 100644 --- a/Public/TableOfContents/Infrastructure/Ui/TableOfContentsRenderer.php +++ b/Public/TableOfContents/Infrastructure/Ui/TableOfContentsRenderer.php @@ -549,6 +549,12 @@ document.addEventListener('DOMContentLoaded', function() { if (sectionMap[topMostSection]) { sectionMap[topMostSection].classList.add('active'); currentActive = topMostSection; + + // Auto-scroll del TOC para mostrar el elemento activo + sectionMap[topMostSection].scrollIntoView({ + behavior: 'smooth', + block: 'nearest' + }); } } }