diff --git a/src/static/js/app.js b/src/static/js/app.js index e503869..c700f52 100644 --- a/src/static/js/app.js +++ b/src/static/js/app.js @@ -636,15 +636,18 @@ const App = { if (inc) this._announceForSR('Lage ausgewählt: ' + inc.title); this.renderSidebar(); - var mc = document.getElementById("main-content"); + var mc = document.getElementById(main-content); mc.scrollTop = 0; document.getElementById('empty-state').style.display = 'none'; document.getElementById('incident-view').style.display = 'flex'; - // GridStack-Animation temporaer deaktivieren um Scroll-Sprung zu verhindern + // GridStack-Animation deaktivieren und Scroll komplett sperren + // bis alle Tile-Resize-Operationen (doppeltes rAF) abgeschlossen sind var gridEl = document.querySelector('.grid-stack'); if (gridEl) gridEl.classList.remove('grid-stack-animate'); + var scrollLock = function() { mc.scrollTop = 0; }; + mc.addEventListener('scroll', scrollLock); // gridstack-Layout initialisieren (einmalig) if (typeof LayoutManager !== 'undefined') LayoutManager.init(); @@ -660,11 +663,16 @@ const App = { await this.loadIncidentDetail(id); - // Zum Header scrollen und Animation wieder aktivieren + // Scroll-Sperre nach 3 Frames aufheben (nach allen doppelten rAF-Callbacks) mc.scrollTop = 0; requestAnimationFrame(() => { - mc.scrollTop = 0; - if (gridEl) gridEl.classList.add('grid-stack-animate'); + requestAnimationFrame(() => { + requestAnimationFrame(() => { + mc.scrollTop = 0; + mc.removeEventListener('scroll', scrollLock); + if (gridEl) gridEl.classList.add('grid-stack-animate'); + }); + }); });