feat(toc): auto-scroll del sidebar al elemento activo

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 <noreply@anthropic.com>
This commit is contained in:
FrankZamora
2025-11-29 11:19:30 -06:00
parent a01ebf303e
commit 371af1f7e5

View File

@@ -549,6 +549,12 @@ document.addEventListener('DOMContentLoaded', function() {
if (sectionMap[topMostSection]) { if (sectionMap[topMostSection]) {
sectionMap[topMostSection].classList.add('active'); sectionMap[topMostSection].classList.add('active');
currentActive = topMostSection; currentActive = topMostSection;
// Auto-scroll del TOC para mostrar el elemento activo
sectionMap[topMostSection].scrollIntoView({
behavior: 'smooth',
block: 'nearest'
});
} }
} }
} }