From d58c915a0b40cf61ff4846b13892e330cdf8c96c Mon Sep 17 00:00:00 2001 From: Vinta Chen Date: Tue, 24 Mar 2026 12:37:36 +0800 Subject: [PATCH] fix(a11y): respect prefers-reduced-motion in back-to-top scroll Swap the hardcoded 'smooth' scroll behavior for a runtime check so users who have enabled reduced-motion in their OS get instant (auto) scrolling instead of the animated kind. Co-Authored-By: Claude --- website/static/main.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/website/static/main.js b/website/static/main.js index f1150b0..535e916 100644 --- a/website/static/main.js +++ b/website/static/main.js @@ -394,7 +394,8 @@ if (backToTop) { backToTop.addEventListener("click", function () { const target = searchInput || resultsSection; if (!target) return; - target.scrollIntoView({ behavior: "smooth", block: "center" }); + var motion = window.matchMedia("(prefers-reduced-motion: reduce)").matches ? "auto" : "smooth"; + target.scrollIntoView({ behavior: motion, block: "center" }); if (searchInput) searchInput.focus(); });