Skip to content

Commit

Permalink
Scroll fix
Browse files Browse the repository at this point in the history
  • Loading branch information
TatianaFomina committed Apr 6, 2022
1 parent 085da8e commit 82deae5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
13 changes: 13 additions & 0 deletions src/components/modules/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,14 @@ export default class UI extends Module<UINodes> {
this.isMobile = window.innerWidth < 650;
}

/**
* Updates --vh variable value, which allows to calculate actual 100vh value for mobile browsers
*/
private setAppHeightFraction(): void {
const doc = document.documentElement
doc.style.setProperty('--vh', (window.innerHeight * 0.01) + 'px');
}

/**
* Makes Editor.js interface
*/
Expand Down Expand Up @@ -437,6 +445,11 @@ export default class UI extends Module<UINodes> {
* Detect mobile version
*/
this.checkIsMobile();

/**
* Updates stored window height fraction
*/
this.setAppHeightFraction();
}

/**
Expand Down
3 changes: 2 additions & 1 deletion src/styles/ui.css
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@
}

.ce-scroll-locked, .ce-scroll-locked > body {
height: 100vh;
height: 100vh; /* Fallback for browsers that do not support Custom Properties */
height: calc(var(--vh) * 100);
overflow: hidden;
/**
* Mobile Safari fix
Expand Down

0 comments on commit 82deae5

Please sign in to comment.