From ee6cbee6f2d88e6871232e80f5ff2ede0ba395df Mon Sep 17 00:00:00 2001 From: claude-dev Date: Tue, 10 Mar 2026 11:10:28 +0100 Subject: [PATCH] Fix scroll-to-factcheck: disable GridStack animation during incident switch Remove grid-stack-animate class before rendering to prevent CSS transitions from causing browser scroll-follow to repositioned tiles. Re-enable animation after content is loaded and scroll is reset. Co-Authored-By: Claude Opus 4.6 --- src/static/js/app.js | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/static/js/app.js b/src/static/js/app.js index a5d433d..e503869 100644 --- a/src/static/js/app.js +++ b/src/static/js/app.js @@ -632,22 +632,24 @@ const App = { this.closeRefreshHistory(); this.currentIncidentId = id; localStorage.setItem('selectedIncidentId', id); - // SR-Announcement - // Scroll komplett blockieren bevor irgendetwas gerendert wird - var mc = document.getElementById("main-content"); - mc.style.overflow = "hidden"; - mc.scrollTop = 0; const inc = this.incidents.find(i => i.id === id); if (inc) this._announceForSR('Lage ausgewählt: ' + inc.title); this.renderSidebar(); + 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 + var gridEl = document.querySelector('.grid-stack'); + if (gridEl) gridEl.classList.remove('grid-stack-animate'); + // gridstack-Layout initialisieren (einmalig) if (typeof LayoutManager !== 'undefined') LayoutManager.init(); - // Refresh-Status für diese Lage wiederherstellen + // Refresh-Status fuer diese Lage wiederherstellen const isRefreshing = this._refreshingIncidents.has(id); this._updateRefreshButton(isRefreshing); if (isRefreshing) { @@ -656,10 +658,14 @@ const App = { UI.hideProgress(); } - mc.scrollTop = 0; await this.loadIncidentDetail(id); + + // Zum Header scrollen und Animation wieder aktivieren mc.scrollTop = 0; - setTimeout(() => { mc.scrollTop = 0; mc.style.overflow = ""; }, 500); + requestAnimationFrame(() => { + mc.scrollTop = 0; + if (gridEl) gridEl.classList.add('grid-stack-animate'); + });