Skip to content

Commit 82deae5

Browse files
committed
Scroll fix
1 parent 085da8e commit 82deae5

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/components/modules/ui.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,14 @@ export default class UI extends Module<UINodes> {
269269
this.isMobile = window.innerWidth < 650;
270270
}
271271

272+
/**
273+
* Updates --vh variable value, which allows to calculate actual 100vh value for mobile browsers
274+
*/
275+
private setAppHeightFraction(): void {
276+
const doc = document.documentElement
277+
doc.style.setProperty('--vh', (window.innerHeight * 0.01) + 'px');
278+
}
279+
272280
/**
273281
* Makes Editor.js interface
274282
*/
@@ -437,6 +445,11 @@ export default class UI extends Module<UINodes> {
437445
* Detect mobile version
438446
*/
439447
this.checkIsMobile();
448+
449+
/**
450+
* Updates stored window height fraction
451+
*/
452+
this.setAppHeightFraction();
440453
}
441454

442455
/**

src/styles/ui.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@
129129
}
130130

131131
.ce-scroll-locked, .ce-scroll-locked > body {
132-
height: 100vh;
132+
height: 100vh; /* Fallback for browsers that do not support Custom Properties */
133+
height: calc(var(--vh) * 100);
133134
overflow: hidden;
134135
/**
135136
* Mobile Safari fix

0 commit comments

Comments
 (0)