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

Function syncActiveSection

js/userGuidance.js:759–778  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

757 }
758
759 const syncActiveSection = function () {
760 // Keep the clicked destination active while smooth scrolling settles,
761 // including sections near the end that cannot reach the panel's top.
762 if (navigationTarget) {
763 OCA.Analytics.Notification.updateEnhancedDialogActiveSection(navLinks, navigationTarget);
764 releaseNavigationTarget();
765 return;
766 }
767 const panelPaddingTop = parseInt(window.getComputedStyle(panel).paddingTop, 10) || 0;
768 const panelTop = panel.scrollTop + panelPaddingTop + sectionScrollOffset;
769 let activeSectionId = sections[0].id;
770
771 sections.forEach((section) => {
772 if (sectionTop(section) <= panelTop + 1) {
773 activeSectionId = section.id;
774 }
775 });
776
777 OCA.Analytics.Notification.updateEnhancedDialogActiveSection(navLinks, activeSectionId);
778 };
779
780 panel.addEventListener('scroll', syncActiveSection, {passive: true});
781 syncActiveSection();

Callers 1

userGuidance.jsFile · 0.85

Calls 2

releaseNavigationTargetFunction · 0.85
sectionTopFunction · 0.85

Tested by

no test coverage detected