On mobile the on-screen keyboard overlays the layout viewport instead of resizing it (iOS Safari always; Android Chrome under its default interactive-widget=resizes-visual). The dashboard shell is a fixed h-dvh column, so the xterm host's bounding box never changed when the keyboard opened: fit() computed identical (cols, rows), no RESIZE reached the PTY, and the Ink input line — drawn at the bottom of the grid — stayed hidden under the keyboard. Fix, in three parts: 1. Keyboard-inset handling (new web/src/lib/keyboard-inset.ts). computeKeyboardInset() measures the layout-viewport region obscured by the keyboard via window.visualViewport (innerHeight - vv.height - vv.offsetTop, with an 80px floor so collapsing URL-bar chrome doesn't thrash the grid). ChatPage applies it as bottom padding on the terminal wrapper, which shrinks the host → the existing ResizeObserver/fit path recomputes rows and sends RESIZE → Ink redraws the input line above the keyboard. Listens on both vv resize and scroll (offsetTop changes arrive as scroll events on iOS). 2. interactive-widget=resizes-content in the viewport meta. Android Chrome 108+ then resizes the layout viewport natively and the JS inset computes ~0 (harmless no-op); iOS ignores the directive and takes the JS path. 3. Scroll pinning. iOS auto-scrolls the page to reveal xterm's hidden textarea on focus, which drags the fixed shell offscreen. While a keyboard inset is active we pin window/scrollingElement scroll back to 0 and term.scrollToBottom() so the freshly-resized input line stays in view. Unit tests cover the inset math (thresholds, offsetTop, rotation races, fractional geometry, non-finite guards). Grid-level behavior needs a real device pass — DevTools emulation doesn't model keyboard insets.
17 lines
448 B
HTML
17 lines
448 B
HTML
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<link rel="icon" type="image/svg+xml" href="/favicon.ico" />
|
|
<meta
|
|
name="viewport"
|
|
content="width=device-width, initial-scale=1.0, viewport-fit=cover, interactive-widget=resizes-content"
|
|
/>
|
|
<title>Hermes Agent - Dashboard</title>
|
|
</head>
|
|
<body>
|
|
<div id="root"></div>
|
|
<script type="module" src="/src/main.tsx"></script>
|
|
</body>
|
|
</html>
|