Skip to content

Commit 8e5822b

Browse files
author
Fred Heusschen
committed
scroll fix
1 parent 3e2210a commit 8e5822b

File tree

7 files changed

+13
-9
lines changed

7 files changed

+13
-9
lines changed

dist/core/offcanvas/mmenu.offcanvas.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,8 @@ Mmenu.prototype.close = function () {
148148
const focus = this.node.open || document.querySelector(`[href="#${this.node.menu.id}"]`) || Mmenu.node.page || null;
149149
(_a = focus) === null || _a === void 0 ? void 0 : _a.focus();
150150
// Prevent html/body from scrolling due to focus.
151-
document.documentElement.scrollLeft = 0;
152151
document.body.scrollLeft = 0;
152+
document.documentElement.scrollLeft = 0;
153153
// Invoke "after" hook.
154154
this.trigger('close:after');
155155
};

dist/core/oncanvas/mmenu.oncanvas.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,10 @@ export default class Mmenu {
131131
if (setfocus) {
132132
panel.focus();
133133
// Prevent panels from scrolling due to focus.
134+
panel.scrollLeft = 0;
134135
this.node.pnls.scrollLeft = 0;
135-
this.node.pnls.scrollTop = 0;
136+
document.body.scrollLeft = 0;
137+
document.documentElement.scrollLeft = 0;
136138
}
137139
}
138140
// Invoke "after" hook.

dist/mmenu.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mmenu-js",
3-
"version": "9.1.5",
3+
"version": "9.1.6",
44
"main": "dist/mmenu.js",
55
"module": "src/mmenu.js",
66
"author": "Fred Heusschen <[email protected]>",

src/core/offcanvas/mmenu.offcanvas.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,8 @@ Mmenu.prototype.close = function (this: Mmenu) {
188188
(focus as HTMLElement)?.focus();
189189

190190
// Prevent html/body from scrolling due to focus.
191-
document.documentElement.scrollLeft = 0;
192191
document.body.scrollLeft = 0;
192+
document.documentElement.scrollLeft = 0;
193193

194194
// Invoke "after" hook.
195195
this.trigger('close:after');

src/core/oncanvas/mmenu.oncanvas.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,10 +204,12 @@ export default class Mmenu {
204204
// Focus the panels.
205205
if (setfocus) {
206206
panel.focus();
207-
207+
208208
// Prevent panels from scrolling due to focus.
209+
panel.scrollLeft = 0;
209210
this.node.pnls.scrollLeft = 0;
210-
this.node.pnls.scrollTop = 0;
211+
document.body.scrollLeft = 0;
212+
document.documentElement.scrollLeft = 0;
211213
}
212214
}
213215

0 commit comments

Comments
 (0)