From 78bb29d1dc45acedf7ec8990e1ca2c47978b5087 Mon Sep 17 00:00:00 2001 From: r00ster91 Date: Sun, 14 Aug 2022 19:17:20 +0200 Subject: [PATCH] fix: scroll page to very top when S is pressed Credits go to @rudedogg --- lib/docs/index.html | 2 +- lib/docs/main.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/docs/index.html b/lib/docs/index.html index 37025c4e72..236923c1d8 100644 --- a/lib/docs/index.html +++ b/lib/docs/index.html @@ -612,7 +612,7 @@ -
+
diff --git a/lib/docs/main.js b/lib/docs/main.js index 680fc1d962..e2b5162beb 100644 --- a/lib/docs/main.js +++ b/lib/docs/main.js @@ -41,7 +41,7 @@ var zigAnalysis; const domSearch = document.getElementById("search"); const domSectSearchResults = document.getElementById("sectSearchResults"); const domSectSearchAllResultsLink = document.getElementById("sectSearchAllResultsLink"); - + const domDocs = document.getElementById("docs"); const domListSearchResults = document.getElementById("listSearchResults"); const domSectSearchNoResults = document.getElementById("sectSearchNoResults"); const domSectInfo = document.getElementById("sectInfo"); @@ -3262,9 +3262,9 @@ var zigAnalysis; break; case "s": if (domHelpModal.classList.contains("hidden")) { - // TODO: scroll the page to the very top domSearch.focus(); domSearch.select(); + domDocs.scrollTo(0, 0); ev.preventDefault(); ev.stopPropagation(); startAsyncSearch();