Skip to content

Commit 51edc8a

Browse files
committed
Fix sidenav issues
1 parent 1d3b547 commit 51edc8a

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/js/navigation/sidenav.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,15 +211,21 @@ class Sidenav {
211211
const { x } = this._element.getBoundingClientRect();
212212

213213
if (
214-
(this.options.sidenavRight && !isRTL) ||
215-
(!this.options.sidenavRight && isRTL)
214+
(this.options.sidenavRight && !isRTL()) ||
215+
(!this.options.sidenavRight && isRTL())
216216
) {
217217
let scrollBarWidth = 0;
218218
// check if there is scrollbar and account for it width if there is one
219-
if (this.container.scrollHeight >= this.container.clientHeight) {
219+
if (this.container.scrollHeight > this.container.clientHeight) {
220220
scrollBarWidth =
221221
this.container.offsetWidth - this.container.clientWidth;
222222
}
223+
224+
if (this.container.tagName === "BODY") {
225+
const documentWidth = document.documentElement.clientWidth;
226+
scrollBarWidth = Math.abs(window.innerWidth - documentWidth);
227+
}
228+
223229
return Math.abs(x + scrollBarWidth - containerEnd) > 10;
224230
}
225231

0 commit comments

Comments
 (0)