From 43011e4dd83f1875ec760961125c3aa3ed1e0709 Mon Sep 17 00:00:00 2001 From: Chris Fulljames Date: Mon, 3 Mar 2025 19:58:06 -0500 Subject: [PATCH] Scroll to top when loading new page --- static/nav.js | 6 ++++-- todo.txt | 1 - 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/static/nav.js b/static/nav.js index 101e3e5..4926f83 100644 --- a/static/nav.js +++ b/static/nav.js @@ -72,9 +72,8 @@ async function handleAjaxResponse(response) { // Got an error; redirect to the error page window.location.href = response.url; } - // Update URL in browser window, minus request-type field + // Update URL in browser window var url = new URL(response.url); - url.searchParams.delete("request-type"); // Get page content from response var text = await response.text(); @@ -124,6 +123,9 @@ function updatePageState(data) { // Trigger event to signal new page has loaded var event = new Event("DOMContentLoaded"); document.dispatchEvent(event); + + // Scroll to top of page + window.scrollTo(0, 0); } async function checkForNewActivity() { diff --git a/todo.txt b/todo.txt index 4b6fc78..492a1db 100644 --- a/todo.txt +++ b/todo.txt @@ -1,4 +1,3 @@ -- Scroll to top of new page - Add to playlist in background - Pinned profile playlists -- 2.39.5