mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-06-16 01:35:36 -04:00
Email list: scroll an expanded card into view after click
When clicking an email higher up in the list, its top edge can be hiding behind the modal header or off-screen. After applying the .email-card-expanded class + the new minHeight, scrollIntoView(block:start) on the next animation frame so the user sees the whole card.
This commit is contained in:
@@ -2249,6 +2249,13 @@ async function _toggleCardPreview(card, em) {
|
||||
card.classList.add('email-card-expanded');
|
||||
card.classList.add('doclib-card-expanded');
|
||||
card.style.minHeight = `${Math.round(stableOpenHeight)}px`;
|
||||
// Pull the card into view in case the user clicked an email further up
|
||||
// the list whose top is partially scrolled off the viewport. Wait for
|
||||
// the layout to settle (minHeight just changed) before scrolling so
|
||||
// the browser scrolls toward the post-expansion position.
|
||||
requestAnimationFrame(() => {
|
||||
try { card.scrollIntoView({ behavior: 'smooth', block: 'start' }); } catch (_) {}
|
||||
});
|
||||
if (!em.is_read) {
|
||||
_syncEmailReadState(em.uid, true);
|
||||
fetch(`${API_BASE}/api/email/mark-read/${em.uid}?folder=${encodeURIComponent(folderAtStart)}${_acct()}`, { method: 'POST' })
|
||||
|
||||
Reference in New Issue
Block a user