enhance(frontend): improve useScrollPositionKeeper

This commit is contained in:
syuilo
2025-06-24 20:30:32 +09:00
parent 36989e0cd3
commit 684424f26a

View File

@@ -22,6 +22,12 @@ export function useScrollPositionKeeper(scrollContainerRef: Ref<HTMLElement | nu
if (!el) return;
if (!ready) return;
if (el.scrollTop < 100) {
// 上部にいるときはanchorを参照するとズレの原因になるし位置復元するメリットも乏しいため設定しない
anchorId = null;
return;
}
const scrollContainerRect = el.getBoundingClientRect();
const viewPosition = scrollContainerRect.height / 2;