diff --git a/src/components/ThreadEnvelope.vue b/src/components/ThreadEnvelope.vue index b65838446b..b9f7e621c2 100644 --- a/src/components/ThreadEnvelope.vue +++ b/src/components/ThreadEnvelope.vue @@ -21,7 +21,9 @@ -
+
{ const threadElement = document.querySelector(`[data-thread-id="${threadId}"]`) if (threadElement) { - threadElement.scrollIntoView({ behavior: 'smooth', block: 'top' }) + threadElement.scrollIntoView({ + behavior: 'smooth', + block: 'start', + }) } }) }, scrollToEnvelope() { this.$nextTick(() => { - const envelopeElement = this.$refs.envelope - if (envelopeElement) { - envelopeElement.scrollIntoView({ behavior: 'smooth', block: 'top' }) + const envelopeHeaderElement = this.$refs.header + const subjectElement = document.querySelector('#mail-thread-header') + + if (envelopeHeaderElement) { + if (subjectElement) { + const subjectHeight = subjectElement.offsetHeight + envelopeHeaderElement.style.scrollMarginTop = `${subjectHeight}px` + } + envelopeHeaderElement.scrollIntoView({ behavior: 'smooth', block: 'start', container: 'nearest' }) } }) },