From 15ce86d6f3d1ec130d0306ff45ba269bcb606cc3 Mon Sep 17 00:00:00 2001 From: LionTion Date: Fri, 23 Oct 2026 22:58:01 +0200 Subject: [PATCH] few textfield improvements --- src/app/page.tsx | 19 ++++++++++++++++++- src/css/RiddleStyles.module.css | 1 + src/utils/const.ts | 2 +- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/app/page.tsx b/src/app/page.tsx index deeae28..b6f04ec 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -26,6 +26,7 @@ export default function Main() { useEffect(() => { if (!hasAttachedListerner && step > 0) { + setHasAttachedListener(true); const doFullscreen = () => { if (screenfull.isEnabled) { screenfull.request(); @@ -34,7 +35,23 @@ export default function Main() { window.addEventListener("click", () => { doFullscreen(); }); - setHasAttachedListener(true); + if (window.visualViewport) { + const handleResize = () => { + const keyboardHeight = window.innerHeight - window.visualViewport.height; + const appContainer = document.querySelector('#app'); + if (appContainer) { + appContainer.style.paddingBottom = keyboardHeight > 0 ? `${keyboardHeight}px` : '0px'; + } + + if (document.activeElement && keyboardHeight > 0) { + document.activeElement.scrollIntoView({ behavior: 'smooth', block: 'center' }); + } + }; + + window.visualViewport.addEventListener('resize', handleResize); + window.visualViewport.addEventListener('scroll', handleResize); + } + doFullscreen(); } }, [step, hasAttachedListerner, setHasAttachedListener]); diff --git a/src/css/RiddleStyles.module.css b/src/css/RiddleStyles.module.css index a4e00a3..1396989 100644 --- a/src/css/RiddleStyles.module.css +++ b/src/css/RiddleStyles.module.css @@ -14,6 +14,7 @@ .content { height: 100%; max-height: 50dvh; + padding-bottom: 15dvh; p { font-size: 1.3rem; margin-bottom: 1rem; diff --git a/src/utils/const.ts b/src/utils/const.ts index 5d1f939..1da11c7 100644 --- a/src/utils/const.ts +++ b/src/utils/const.ts @@ -16,4 +16,4 @@ const isDev = process.env.NODE_ENV === "development"; export const HTTP_SCHEME = isDev ? "http" : "https"; export const WS_SCHEME = isDev ? "ws" : "wss"; -export const API_PREFIX = isDev ? "10.8.0.23:8080" : "api.excaliburs-erben.de"; \ No newline at end of file +export const API_PREFIX = isDev ? "192.168.0.110:8080" : "api.excaliburs-erben.de"; \ No newline at end of file