From 974765ebef3dc12f80f9952a5fc9906d09bdf392 Mon Sep 17 00:00:00 2001 From: Richard Harris Date: Sat, 29 Dec 2018 09:25:58 -0500 Subject: [PATCH] prevent annoying sidebar scrolling glitch --- site/src/routes/guide/_GuideContents.html | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/site/src/routes/guide/_GuideContents.html b/site/src/routes/guide/_GuideContents.html index 74f66a6256..ff6fa60813 100644 --- a/site/src/routes/guide/_GuideContents.html +++ b/site/src/routes/guide/_GuideContents.html @@ -5,6 +5,7 @@ export let sections = []; export let active_section = null; export let show_contents; + export let prevent_sidebar_scroll = false; onMount(() => { // ------------------------------------------ @@ -42,8 +43,8 @@ afterUpdate(() => { // bit of a hack — prevent sidebar scrolling if - // TOC is open on mobile - if (show_contents && window.innerWidth < 832) return; + // TOC is open on mobile, or scroll came from within sidebar + if (prevent_sidebar_scroll || show_contents && window.innerWidth < 832) return; const active = ul.querySelector('.active'); @@ -97,7 +98,12 @@ .active { color: var(--prime) } -