diff --git a/aiui/packages/app/index.html b/aiui/packages/app/index.html index c852ae6d..b8f4ee77 100644 --- a/aiui/packages/app/index.html +++ b/aiui/packages/app/index.html @@ -2,7 +2,15 @@
- + + diff --git a/docs/companion-keyboard-viewport.md b/docs/companion-keyboard-viewport.md new file mode 100644 index 00000000..1163e076 --- /dev/null +++ b/docs/companion-keyboard-viewport.md @@ -0,0 +1,99 @@ +# Companion app — soft-keyboard viewport handover + +**Audience:** the companion (Android WebView wrapper) developer. +**Reported:** 2026-08-04 by the operator — in chat, when the soft keyboard opens, +padding is added to the bottom tab bar and the page scrolls; the chat window +should instead scale to the height that remains above the keyboard. + +## Why this is (most likely) companion-side + +The symptom described — content keeps its full height, the browser *pans/scrolls* +the focused input into view, and the fixed bottom bar picks up a visual gap — is +the classic Android `adjustPan` (or edge-to-edge-without-IME-insets) signature. + +The web side already implements the correct contract, verified in-repo: + +1. **`neode-ui/index.html`** carries + `interactive-widget=resizes-content` in its viewport meta. In Chrome 108+ + this makes the keyboard resize the **layout** viewport, so + `window.innerHeight` shrinks. +2. **`neode-ui/src/main.ts` → `syncViewportHeightVar()`** mirrors + `window.innerHeight` into the CSS var `--visual-viewport-height` on + `resize`, `orientationchange`, and `visualViewport.resize`. It deliberately + uses `innerHeight` (not `visualViewport.height`) so the value shares a + reference frame with `position: fixed` elements like the mobile tab bar. +3. **`neode-ui/src/style.css`** sizes the mobile layout (including the chat + iframe container) from + `var(--visual-viewport-height, 100dvh)` minus the tab-bar/safe-area vars. + +So on mobile web Chrome, the keyboard shrinks `innerHeight`, the var updates, +and the chat scales. **An Android WebView ignores the `interactive-widget` +meta entirely** — keyboard resize there is governed by the host app. If the +host pans instead of resizing, no amount of web CSS can fix it: the WebView's +`innerHeight` never changes and the system scrolls the page instead. + +## What the companion app should do + +Pick the branch that matches how the Activity is configured: + +### A. Not edge-to-edge (no `WindowCompat.setDecorFitsSystemWindows(window, false)`) + +Set the soft-input mode so the WebView is *resized*, not panned: + +```xml + +