diff --git a/cptr/frontend/src/app.css b/cptr/frontend/src/app.css index 807c3bd..31bdf3e 100644 --- a/cptr/frontend/src/app.css +++ b/cptr/frontend/src/app.css @@ -31,10 +31,24 @@ border-color: var(--color-gray-200, currentColor); } + html, + body { + height: 100dvh; + margin: 0; + overflow: hidden; + overscroll-behavior: none; + scrollbar-width: none; + -ms-overflow-style: none; + } + + html::-webkit-scrollbar, + body::-webkit-scrollbar { + display: none; + } + html { color-scheme: dark light; touch-action: manipulation; - overscroll-behavior: none; } button { diff --git a/cptr/frontend/src/routes/+layout.svelte b/cptr/frontend/src/routes/+layout.svelte index f28d6cb..02c54bb 100644 --- a/cptr/frontend/src/routes/+layout.svelte +++ b/cptr/frontend/src/routes/+layout.svelte @@ -38,7 +38,7 @@ let { children } = $props(); let showQuickOpen = $state(false); let showSettings = $state(false); - let viewportHeight = $state('100dvh'); + let terminalVvHeight = $state(''); // Auth state type AuthState = 'checking' | 'needs_setup' | 'needs_login' | 'authenticated'; @@ -66,20 +66,21 @@ 30 * 60 * 1000 ); - // iOS/Android: visualViewport gives accurate height when keyboard is open. - // Debounce to avoid firing dozens of resizes during the keyboard animation - // (~300ms). We only commit the final height after things settle, which - // prevents TUI apps from receiving multiple SIGWINCH and re-rendering. + // Terminal needs a JS height override because xterm uses a hidden + // textarea that doesn't trigger interactive-widget=resizes-content. + // Chat and other tabs use pure CSS (dvh) — no JS needed. const vv = window.visualViewport; let vpTimer: ReturnType; if (vv) { const update = () => { clearTimeout(vpTimer); vpTimer = setTimeout(() => { - viewportHeight = `${vv.height}px`; + const keyboardHeight = window.innerHeight - vv.height; + terminalVvHeight = keyboardHeight > 100 ? `${vv.height}px` : ''; }, 350); }; vv.addEventListener('resize', update); + return () => { clearTimeout(vpTimer); clearInterval(healthCheck); @@ -90,6 +91,11 @@ return () => clearInterval(healthCheck); }); + // Only apply JS pixel height for terminal tabs; everything else uses CSS dvh. + const appHeight = $derived( + $activeTab?.type === 'terminal' && terminalVvHeight ? terminalVvHeight : '' + ); + let startupToken = $state(''); $effect(() => { @@ -249,8 +255,8 @@ /> {:else if $stateLoaded}