From eb5b37daf519da88fa9b04a261226db83d02780f Mon Sep 17 00:00:00 2001
From: Vinta Chen
Date: Tue, 24 Mar 2026 13:08:22 +0800
Subject: [PATCH] feat(ux): smooth-scroll hero CTA without updating URL hash
Add a data-scroll-to attribute to the hero 'Browse the List' anchor
and a JS handler that calls scrollIntoView instead of letting the
browser follow the href, so the URL hash is never written.
Respects prefers-reduced-motion.
Co-Authored-By: Claude
---
website/static/main.js | 11 +++++++++++
website/templates/index.html | 2 +-
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/website/static/main.js b/website/static/main.js
index f3e29f6..32b71fb 100644
--- a/website/static/main.js
+++ b/website/static/main.js
@@ -44,6 +44,17 @@ function initRevealSections() {
initRevealSections();
+// Smooth scroll without hash in URL
+document.querySelectorAll("[data-scroll-to]").forEach(function (link) {
+ link.addEventListener("click", function (e) {
+ var target = document.getElementById(link.dataset.scrollTo);
+ if (!target) return;
+ e.preventDefault();
+ var motion = window.matchMedia("(prefers-reduced-motion: reduce)").matches ? "auto" : "smooth";
+ target.scrollIntoView({ behavior: motion });
+ });
+});
+
// Pause hero animations when scrolled out of view
(function () {
const hero = document.querySelector(".hero");
diff --git a/website/templates/index.html b/website/templates/index.html
index 7c1a000..3155874 100644
--- a/website/templates/index.html
+++ b/website/templates/index.html
@@ -36,7 +36,7 @@