From f8153cc323886212eadfa823c44fac9cf306250e Mon Sep 17 00:00:00 2001 From: Julien Marcou Date: Mon, 1 Feb 2021 17:57:34 +0100 Subject: [PATCH] Fix scrollbar track bounding box not being up to date when clicking on the scrollbar track to scroll --- index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/index.js b/index.js index 4930d1e..f25662b 100644 --- a/index.js +++ b/index.js @@ -326,6 +326,7 @@ export class ScrollableComponentElement extends HTMLElement { // Scroll to mouse position in scrollbar's track this.elements[orientation].scrollbarTrack.addEventListener('mousedown', (event) => { + this.boundingBoxes[orientation].scrollbarTrack = this.elements[orientation].scrollbarTrack.getBoundingClientRect(); this.viewport.scrollTo({ [spacings[orientation]]: (event[clients[orientation]] - this.boundingBoxes[orientation].scrollbarTrack[spacings[orientation]] - this.sizes[orientation].scrollbarThumb / 2) * this.ratios[orientation], behavior: 'smooth',