A neat trick (now third hand) for storing the scroll position of a sidebar or other element in local storage, allowing you to keep it constant across pages without the user seeing it flash into place:
let sidebar = document.querySelector(".sidebar"); let top = localStorage.getItem("sidebar-scroll"); if (top !== null) { sidebar.scrollTop = parseInt(top, 10); } window.addEventListener("beforeunload", () => { localStorage.setItem("sidebar-scroll", sidebar.scrollTop); });