MCPcopy Create free account
hub / github.com/Rello/analytics / syncActiveSection

Function syncActiveSection

js/userGuidance.js:629–648  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

627 }
628
629 const syncActiveSection = function () {
630 // Keep the clicked destination active while smooth scrolling settles,
631 // including sections near the end that cannot reach the panel's top.
632 if (navigationTarget) {
633 OCA.Analytics.Notification.updateEnhancedDialogActiveSection(navLinks, navigationTarget);
634 releaseNavigationTarget();
635 return;
636 }
637 const panelPaddingTop = parseInt(window.getComputedStyle(panel).paddingTop, 10) || 0;
638 const panelTop = panel.scrollTop + panelPaddingTop + sectionScrollOffset;
639 let activeSectionId = sections[0].id;
640
641 sections.forEach((section) => {
642 if (sectionTop(section) <= panelTop + 1) {
643 activeSectionId = section.id;
644 }
645 });
646
647 OCA.Analytics.Notification.updateEnhancedDialogActiveSection(navLinks, activeSectionId);
648 };
649
650 panel.addEventListener('scroll', syncActiveSection, {passive: true});
651 syncActiveSection();

Callers 1

userGuidance.jsFile · 0.85

Calls 2

releaseNavigationTargetFunction · 0.85
sectionTopFunction · 0.85

Tested by

no test coverage detected