From fb99054e4bc5f4d375736edb3623e329fecc73df Mon Sep 17 00:00:00 2001 From: MarekWo Date: Mon, 6 Apr 2026 12:19:44 +0200 Subject: [PATCH] fix: defer FAB position restore when iframe viewport is too small The DM iframe reloads on every modal open. During the show transition the viewport is 0x0, causing clampFabPosition to push buttons to the top-left corner. Now polls until viewport is valid before restoring. Co-Authored-By: Claude Opus 4.6 --- app/static/js/fab-utils.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/app/static/js/fab-utils.js b/app/static/js/fab-utils.js index 89d1be9..490b104 100644 --- a/app/static/js/fab-utils.js +++ b/app/static/js/fab-utils.js @@ -120,6 +120,21 @@ function restoreFabPosition(container, storageKey) { try { const pos = JSON.parse(saved); + + // If viewport is too small (iframe in hidden modal), defer until visible + if (window.innerWidth < 50 || window.innerHeight < 50) { + const poll = setInterval(() => { + if (window.innerWidth >= 50 && window.innerHeight >= 50) { + clearInterval(poll); + container.style.right = 'auto'; + container.style.left = pos.left + 'px'; + container.style.top = pos.top + 'px'; + clampFabPosition(container); + } + }, 100); + return; + } + container.style.right = 'auto'; container.style.left = pos.left + 'px'; container.style.top = pos.top + 'px';