fix(실적): 수기 입력 뒤 새로고침해도 스크롤 위치 유지

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-02 15:46:17 +09:00
parent 443fa56671
commit b3001c3051
6 changed files with 54 additions and 7 deletions
+22 -1
View File
@@ -1775,9 +1775,30 @@
});
}
// 새로고침해도 스크롤 위치 유지(2026-11-02) — 수기 입력·자동 새로 고침·업로드 뒤 새로고침 모두. 세로는 안쪽 스크롤 상자(.erp-page)라
// 브라우저가 복원하지 않고, 가로는 표 상자. 떠날 때 저장 → 새로고침으로 다시 열릴 때만 복원(메뉴·기간 이동으로 들어오면 맨 위부터).
function keepScroll(root) {
const wrap = root.querySelector(".perf-main-wrap");
if (!wrap) return;
const KEY = "perf_scroll";
const scroller = function () { return scrollParent(wrap) || document.scrollingElement; };
window.addEventListener("pagehide", function () {
try { sessionStorage.setItem(KEY, JSON.stringify({ url: location.href, top: scroller().scrollTop, left: wrap.scrollLeft })); } catch (_) { /* 기억만 못 함 */ }
});
let saved = null;
try {
saved = JSON.parse(sessionStorage.getItem(KEY) || "null");
sessionStorage.removeItem(KEY);
} catch (_) { saved = null; }
const nav = window.performance && performance.getEntriesByType ? performance.getEntriesByType("navigation")[0] : null;
if (!saved || saved.url !== location.href || !nav || nav.type !== "reload") return;
scroller().scrollTop = saved.top;
wrap.scrollLeft = saved.left;
}
document.addEventListener("DOMContentLoaded", function () {
const dash = document.getElementById("perf-dash");
if (dash) { initDashboard(dash); stickyHead(dash); }
if (dash) { initDashboard(dash); stickyHead(dash); keepScroll(dash); }
const set = document.getElementById("perf-settings");
if (set) initSettings(set);
});