From e0344a2418383051b4913cfc12543b0ea1318357 Mon Sep 17 00:00:00 2001 From: Fahim Salam Chowdhury Date: Mon, 4 May 2026 12:38:00 +0600 Subject: [PATCH] fix: on spreed app, consider recovery-banner on counting height --- scss/email-recovery.scss | 3 +++ src/email-recovery.js | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/scss/email-recovery.scss b/scss/email-recovery.scss index 24427a1..2d212d4 100644 --- a/scss/email-recovery.scss +++ b/scss/email-recovery.scss @@ -47,6 +47,9 @@ height: calc(100% - env(safe-area-inset-bottom) - var(--recovery-banner-height) - var(--body-container-margin)) !important; } +.recovery-content-layout-without-margin { + height: calc(100% - env(safe-area-inset-bottom) - var(--recovery-banner-height) - var(--body-container-margin)) !important; +} @media only screen and (max-width: 768px) { diff --git a/src/email-recovery.js b/src/email-recovery.js index 37df6a4..8d14de4 100644 --- a/src/email-recovery.js +++ b/src/email-recovery.js @@ -47,8 +47,43 @@ document.addEventListener('DOMContentLoaded', function() { attributes: true }) } + } } + + /* + * Spreed call seems to reset class list, this restores 'recovery-content-layout-without-margin' class name if another script removes it from classlist + * We don't want to add extra margin-top + * spreed app has 2 base url: /apps/spreed & /call, so we need to consider both + */ + if (window.location.href.includes('/apps/spreed') || window.location.href.includes('/call/')) { + const intervalId = setInterval(() => { + // we need to first try to add on init stage. This is needed so, when user opens a conversation, the chatbox can be visible + const contentVue = document.querySelector('#content-vue') + if (contentVue) { + contentVue.style.setProperty('--recovery-banner-height', topHeight) + contentVue.classList.add('recovery-content-layout-without-margin') + } + + // when a call initiated, the recovery-banner class is removed. We need to re-add it + const observer = new MutationObserver(function(mutations) { + mutations.forEach(function(mutation) { + if (mutation.type === 'attributes' && mutation.attributeName === 'class') { + if (contentVue && banner && !banner.classList.contains('recovery-banner-hidden') && !contentVue.classList.contains('recovery-content-layout-without-margin')) { + contentVue.style.setProperty('--recovery-banner-height', topHeight) + contentVue.classList.add('recovery-content-layout-without-margin') + } + } + }) + }) + observer.observe(contentVue, { + attributes: true + }) + + clearInterval(intervalId) + }, 100) + } + // added special case for bookmarks and passwords if (window.location.href.includes('apps/bookmarks/') || window.location.href.includes('apps/passwords/')) { const intervalId = setInterval(() => { -- GitLab