Agent Zero AI framework
ui: scroll/collapse fixes
frdel9ee98c48237e
diff --git a/webui/js/messages.js b/webui/js/messages.jsindex a5d523ae8..1ab8f775a 100644--- a/webui/js/messages.js+++ b/webui/js/messages.js@@ -79,6 +79,7 @@ export function setMessages(messages) {smooth: !massRender,toleranceRem: 4,reapplyDelayMs: 1000,+ applyStabilization: true,});const results = [];@@ -303,7 +304,7 @@ function drawProcessStep({//expand allif (detailMode === "expanded") {- step.classList.add("expanded");+ toggleStepCollapse(step, true);// expand current step and schedule collapse of previous} else if (detailMode === "current" &&@@ -323,7 +324,7 @@ function drawProcessStep({);scheduleStepCollapse(expandedStep, delay);});- step.classList.add("expanded");+ toggleStepCollapse(step, true);}// create step header@@ -443,6 +444,26 @@ function drawProcessStep({};}+function toggleStepCollapse(step, expanded) {+ if (!step) return;++ let nextExpanded = expanded;+ if (nextExpanded === undefined || nextExpanded === null) {+ nextExpanded = !step.classList.contains("expanded");+ }+ nextExpanded = Boolean(nextExpanded);++ // scroll to top when collapsing+ if (!nextExpanded) {+ setTimeout(() => {+ const scroller = step.querySelector(".process-step-detail-scroll");+ if (scroller) scroller.scrollTop = 0;+ }, 100);+ }++ step.classList.toggle("expanded", nextExpanded);+}+function drawStandaloneMessage({id,heading,@@ -1797,7 +1818,7 @@ function scheduleStepCollapse(}console.log(`Collapse step: ${stepElement.id}`);- stepElement.classList.remove("expanded");+ toggleStepCollapse(stepElement, false);}, delayMs);// Store the timeout ID@@ -1824,7 +1845,7 @@ function setupProcessStepHandlers(stepElement, stepHeader) {e.stopPropagation();cancelStepCollapse(stepElement);stepElement.dataset.clicked = "true";- stepElement.classList.toggle("expanded");+ toggleStepCollapse(stepElement);});}}diff --git a/webui/js/scroller.js b/webui/js/scroller.jsindex f59a51e02..783b34c55 100644--- a/webui/js/scroller.js+++ b/webui/js/scroller.js@@ -6,6 +6,7 @@ export class Scroller {toleranceRem = 2,reapplyDelayMs = 0,reapplyToleranceRatio = 0,+ applyStabilization = false,} = {},) {this.element = element;@@ -21,7 +22,7 @@ export class Scroller {this._resizeObserver = null;this._lastClientHeight = null;- this._initScrollStabilization();+ if (applyStabilization) this._initScrollStabilization();}_initScrollStabilization() {