From 82c0aa240a39c3bca85496a17304e91e59d9fd8e Mon Sep 17 00:00:00 2001 From: Tim <135014430+nagisa77@users.noreply.github.com> Date: Tue, 5 Aug 2025 19:27:02 +0800 Subject: [PATCH] fix: make post page scroller sticky and restore comment hash navigation --- frontend/src/views/PostPageView.vue | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/frontend/src/views/PostPageView.vue b/frontend/src/views/PostPageView.vue index cf113e1d0..bf840feb4 100644 --- a/frontend/src/views/PostPageView.vue +++ b/frontend/src/views/PostPageView.vue @@ -572,8 +572,9 @@ export default { const id = hash.substring('#comment-'.length) await nextTick() const el = document.getElementById('comment-' + id) - if (el && mainContainer.value) { - mainContainer.value.scrollTo({ top: getTopRelativeTo(el, mainContainer.value), behavior: 'instant' }) + if (el) { + const top = el.getBoundingClientRect().top + window.scrollY + window.scrollTo({ top, behavior: 'instant' }) el.classList.add('comment-highlight') setTimeout(() => el.classList.remove('comment-highlight'), 2000) } @@ -671,6 +672,9 @@ export default { display: flex; flex-direction: column; width: 15%; + position: sticky; + top: 0; + align-self: flex-start; } .comment-config-container {