diff --git a/site/src/components/TopNav.svelte b/site/src/components/TopNav.svelte index 4254e99152..49a1be50d1 100644 --- a/site/src/components/TopNav.svelte +++ b/site/src/components/TopNav.svelte @@ -35,12 +35,21 @@ }; }); + // Prevents navbar to show/hide when clicking in docs sidebar + let hash_changed = false; + function handle_hashchange() { + hash_changed = true; + } + let last_scroll = 0; function handle_scroll() { const scroll = window.pageYOffset; - visible = (scroll < 50 || scroll < last_scroll); + if (!hash_changed) { + visible = (scroll < 50 || scroll < last_scroll); + } last_scroll = scroll; + hash_changed = false; } @@ -227,7 +236,7 @@ } - +