From 5d74749fd0b38d0a6f032f089d86f014bd40258e Mon Sep 17 00:00:00 2001 From: Wolfsblvt Date: Sun, 30 Jun 2024 23:23:39 +0200 Subject: [PATCH] Fix toasts misaligning on popup hiding --- public/scripts/popup.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/public/scripts/popup.js b/public/scripts/popup.js index 7068a75b1..f30e3fe1e 100644 --- a/public/scripts/popup.js +++ b/public/scripts/popup.js @@ -624,8 +624,13 @@ export function fixToastrForDialogs() { // Now another case is if we only have one popup and that is currently closing. In that case the toastr container exists, // but we don't have an open dialog to move it into. It's just inside the existing one that will be gone in milliseconds. // To prevent new toasts from being showing up in there and then vanish in an instant, - // we move the toastr back to the main body + // we move the toastr back to the main body, or delete if its empty if (!dlg && isAlreadyPresent) { - document.body.appendChild(toastContainer); + if (!toastContainer.childNodes.length) { + toastContainer.remove(); + } else { + document.body.appendChild(toastContainer); + toastContainer.classList.add('toast-top-center'); + } } }