Skip to content

Commit 78bb29d

Browse files
author
r00ster91
committed
fix: scroll page to very top when S is pressed
Credits go to @rudedogg
1 parent af20dfa commit 78bb29d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/docs/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ <h2><span>Zig Version</span></h2>
612612
</div>
613613
</nav>
614614
</div>
615-
<div class="flex-right">
615+
<div id="docs" class="flex-right">
616616
<div class="wrap">
617617
<section class="docs">
618618
<div style="position: relative">

lib/docs/main.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ var zigAnalysis;
4141
const domSearch = document.getElementById("search");
4242
const domSectSearchResults = document.getElementById("sectSearchResults");
4343
const domSectSearchAllResultsLink = document.getElementById("sectSearchAllResultsLink");
44-
44+
const domDocs = document.getElementById("docs");
4545
const domListSearchResults = document.getElementById("listSearchResults");
4646
const domSectSearchNoResults = document.getElementById("sectSearchNoResults");
4747
const domSectInfo = document.getElementById("sectInfo");
@@ -3262,9 +3262,9 @@ var zigAnalysis;
32623262
break;
32633263
case "s":
32643264
if (domHelpModal.classList.contains("hidden")) {
3265-
// TODO: scroll the page to the very top
32663265
domSearch.focus();
32673266
domSearch.select();
3267+
domDocs.scrollTo(0, 0);
32683268
ev.preventDefault();
32693269
ev.stopPropagation();
32703270
startAsyncSearch();

0 commit comments

Comments
 (0)