Skip to content

Commit

Permalink
Fix scrollbar track bounding box not being up to date when clicking o…
Browse files Browse the repository at this point in the history
…n the scrollbar track to scroll
  • Loading branch information
Julien-Marcou committed Feb 1, 2021
1 parent 45fc16c commit f8153cc
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit f8153cc

Please sign in to comment.