From 9d89df3e7388b90f98c9f5ea36e73ef31c50a1c3 Mon Sep 17 00:00:00 2001 From: Vinta Chen Date: Sun, 22 Mar 2026 15:31:04 +0800 Subject: [PATCH] fix: back-to-top button scrolls to search input and focuses it When results are visible, clicking the button previously scrolled to the results section. It now targets the search input instead, scrolls it into view centered, and focuses it so the user can immediately type a new query. Button label updated from 'Top' to 'Search' to reflect the new destination. Co-Authored-By: Claude --- website/static/main.js | 6 ++++-- website/templates/index.html | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/website/static/main.js b/website/static/main.js index 223100e..c1d8d01 100644 --- a/website/static/main.js +++ b/website/static/main.js @@ -351,8 +351,10 @@ if (backToTop) { window.addEventListener('resize', updateBackToTopVisibility); backToTop.addEventListener('click', function () { - if (!resultsSection) return; - resultsSection.scrollIntoView({ behavior: 'smooth', block: 'start' }); + var target = searchInput || resultsSection; + if (!target) return; + target.scrollIntoView({ behavior: 'smooth', block: 'center' }); + if (searchInput) searchInput.focus(); }); updateBackToTopVisibility(); diff --git a/website/templates/index.html b/website/templates/index.html index f3183f3..a2e737d 100644 --- a/website/templates/index.html +++ b/website/templates/index.html @@ -129,8 +129,8 @@ Last Commit Tags -