Skip to content

Self-hosted AI workspace.

Python

Keep email reader height stable while loading

pewdiepie-archdaemon4f6804192619
diff --git a/static/js/emailLibrary.js b/static/js/emailLibrary.js
index 9fa052b4b..fa27b4a66 100644
--- a/static/js/emailLibrary.js
+++ b/static/js/emailLibrary.js
@@ -1821,9 +1821,13 @@ function _prefetchAdjacentEmails(card, count = 3) {
async function _toggleCardPreview(card, em) {
const grid = card.closest('.doclib-grid');
const gridRect = grid?.getBoundingClientRect?.();
+ const modal = document.getElementById('email-lib-modal');
+ const modalContent = card.closest('.modal-content');
+ const modalRect = modalContent?.getBoundingClientRect?.();
const currentRect = card.getBoundingClientRect();
const stableOpenHeight = Math.max(
currentRect.height || 0,
+ (modalRect?.height || 0) - 84,
Math.min(Math.max(260, window.innerHeight * 0.56), gridRect?.height || window.innerHeight)
);
@@ -1832,7 +1836,8 @@ async function _toggleCardPreview(card, em) {
card.classList.remove('email-card-expanded');
card.classList.remove('doclib-card-expanded');
card.style.minHeight = '';
- document.getElementById('email-lib-modal')?.classList.remove('email-reading');
+ modal?.classList.remove('email-reading');
+ modal?.style.removeProperty('--email-reading-modal-min-h');
const reader = card.querySelector('.email-card-reader');
if (reader) reader.remove();
return;
@@ -1860,7 +1865,10 @@ async function _toggleCardPreview(card, em) {
// Class hook on the modal so the header-hide / padding rules work on
// browsers without :has() support (Firefox mobile) — the :has() versions
// below stay as the desktop path.
- document.getElementById('email-lib-modal')?.classList.add('email-reading');
+ if (modal && modalRect?.height) {
+ modal.style.setProperty('--email-reading-modal-min-h', `${Math.round(modalRect.height)}px`);
+ }
+ modal?.classList.add('email-reading');
// Show loading reader with whirlpool spinner
const reader = document.createElement('div');
diff --git a/static/style.css b/static/style.css
index 18164e73c..1fb16d4b9 100644
--- a/static/style.css
+++ b/static/style.css
@@ -14396,6 +14396,9 @@ body.left-dock-active {
display: flex !important;
flex: 1 1 auto !important;
}
+#email-lib-modal.email-reading .doclib-modal-content {
+ min-height: var(--email-reading-modal-min-h, auto);
+}
#email-lib-modal .doclib-card.doclib-card-expanded {
flex: 1 1 auto !important;
height: 100% !important;