Merge pull request #2881 from SillyTavern/bug/2879 Fix mobile screen funkiness by smashing it with a big hammer

0c4366db44cf2035755a93386565b23c254d451a

Cohee <18619528+Cohee1207@users.noreply.github.com>

Signed
2 files changed, +18 -9Showing whitespace changes
public/css/mobile-styles.css+8 -9
@@ -103,7 +103,6 @@
103103 touch-action: none;
104104 overflow: hidden;
105105 position: fixed;
106-
107106 }
108107
109108 .world_entry_form_control {
@@ -112,7 +111,7 @@
112111
113112 .drawer-content {
114113 min-width: unset;
115114 width: 100%100dvw;
116115 max-height: calc(100vh - 45px);
117116 max-height: calc(100dvh - 45px);
118117 position: fixed;
@@ -159,9 +158,9 @@
159158 #sheld,
160159 #character_popup,
161160 .drawer-content {
162161 width: 100%100dvw !important;
163162 margin: 0 auto;
164163 max-width: 100%100dvw;
165164 left: 0 !important;
166165 resize: none !important;
167166 top: var(--topBarBlockSize);
@@ -233,9 +232,9 @@
233232 /* 100vh are fallback units for browsers that don't support dvh */
234233 height: calc(100vh - 45px);
235234 height: calc(100dvh - 45px);
236235 min-width: 100%100dvw !important;
237236 width: 100%100dvw !important;
238237 max-width: 100%100dvw !important;
239238 overflow-y: hidden;
240239 border-left: 1px solid var(--SmartThemeBorderColor);
241240 border-right: 1px solid var(--SmartThemeBorderColor);
@@ -481,10 +480,10 @@
481480 margin: 0 auto;
482481 height: calc(100vh - 70px);
483482 height: calc(100dvh - 70px);
484483 width: calc(100%100dvw - 5px);
485484 max-height: calc(100vh - 70px);
486485 max-height: calc(100dvh - 70px);
487486 max-width: calc(100%100dvw - 5px);
488487
489488 }
490489
public/scripts/RossAscends-mods.js+10 -0
@@ -737,6 +737,16 @@ export function initRossMods() {
737737 RA_autoconnect();
738738 }
739739
740+ if (isMobile()) {
741+ const fixFunkyPositioning = () => {
742+ console.debug('[Mobile] Device viewport change detected.');
743+ document.documentElement.style.position = 'fixed';
744+ requestAnimationFrame(() => document.documentElement.style.position = '');
745+ };
746+ window.addEventListener('resize', fixFunkyPositioning);
747+ window.addEventListener('orientationchange', fixFunkyPositioning);
748+ }
749+
740750 $('#main_api').change(function () {
741751 var PrevAPI = main_api;
742752 setTimeout(() => RA_autoconnect(PrevAPI), 100);