mirror of
https://github.com/MarekWo/mc-webui.git
synced 2026-05-02 03:22:40 +02:00
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:
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user