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 <noreply@anthropic.com>
This commit is contained in:
MarekWo
2026-04-06 12:19:44 +02:00
parent 60c698deb2
commit fb99054e4b

View File

@@ -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';