From aabc6dd67019d34e4273d5ec5c95c600253f868b Mon Sep 17 00:00:00 2001 From: Marijn Haverbeke Date: Wed, 10 Nov 2021 09:52:53 +0100 Subject: [PATCH] Reset native scrollbar when hiding it To avoid it reinitializing in a scrolled position on Chrome Issue https://github.com/codemirror/CodeMirror/issues/6819 --- src/display/scrollbars.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/display/scrollbars.js b/src/display/scrollbars.js index 18ac121a94..f77ffc19f0 100644 --- a/src/display/scrollbars.js +++ b/src/display/scrollbars.js @@ -60,6 +60,7 @@ class NativeScrollbars { this.vert.firstChild.style.height = Math.max(0, measure.scrollHeight - measure.clientHeight + totalHeight) + "px" } else { + this.vert.scrollTop = 0 this.vert.style.display = "" this.vert.firstChild.style.height = "0" }