Skip to content

Commit

Permalink
Fix sidenav issues
Browse files Browse the repository at this point in the history
  • Loading branch information
juujisai committed Dec 1, 2023
1 parent 1d3b547 commit 51edc8a
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/js/navigation/sidenav.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,15 +211,21 @@ class Sidenav {
const { x } = this._element.getBoundingClientRect();

if (
(this.options.sidenavRight && !isRTL) ||
(!this.options.sidenavRight && isRTL)
(this.options.sidenavRight && !isRTL()) ||
(!this.options.sidenavRight && isRTL())
) {
let scrollBarWidth = 0;
// check if there is scrollbar and account for it width if there is one
if (this.container.scrollHeight >= this.container.clientHeight) {
if (this.container.scrollHeight > this.container.clientHeight) {
scrollBarWidth =
this.container.offsetWidth - this.container.clientWidth;
}

if (this.container.tagName === "BODY") {
const documentWidth = document.documentElement.clientWidth;
scrollBarWidth = Math.abs(window.innerWidth - documentWidth);
}

return Math.abs(x + scrollBarWidth - containerEnd) > 10;
}

Expand Down

0 comments on commit 51edc8a

Please sign in to comment.