diff --git a/src/static/js/components.js b/src/static/js/components.js index de20bd7..49fdf9d 100644 --- a/src/static/js/components.js +++ b/src/static/js/components.js @@ -304,6 +304,7 @@ const UI = { if (!overlay || !popup) return; overlay.style.display = 'flex'; + this._initClickOutside(); // Blocking (no close) for first refresh if (state.isFirst) { @@ -622,6 +623,31 @@ const UI = { }, + // === Click-outside to auto-minimize popup === + _initClickOutside() { + if (this._clickOutsideInit) return; + this._clickOutsideInit = true; + document.addEventListener('click', (e) => { + const overlay = document.getElementById('progress-overlay'); + if (!overlay || overlay.style.display === 'none') return; + const popup = document.getElementById('progress-popup'); + if (!popup) return; + // Ignore clicks inside the popup itself + if (popup.contains(e.target)) return; + // Ignore clicks on the mini bar + const mini = document.getElementById('progress-mini'); + if (mini && mini.contains(e.target)) return; + // Don't minimize during first refresh (blocking) + const currentId = App.currentIncidentId; + const state = this._progressState[currentId]; + if (state && state.isFirst) return; + // Auto-minimize + if (state && !state.minimized) { + this.minimizeProgress(currentId); + } + }); + }, + /** * Zusammenfassung mit Inline-Zitaten und Quellenverzeichnis rendern. */