Phone: keyboard no longer leaves the page shifted
Mobile browsers scroll the whole page up to show the focused input and do not always scroll it back when the keyboard closes; the app never scrolls the page itself, so the top bar (menu) stayed out of reach. - Viewport interactive-widget=resizes-content: on Android the keyboard shrinks the page instead of shifting it. - Elsewhere (iOS Safari) the page offset is undone when the visual viewport grows again or the input loses focus. - The chat keeps following the latest message when its pane shrinks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9fd92d5b39
commit
61219dbca2
4 files changed
+60
-1
No files matched your search
@@ -202,6 +202,17 @@ export function ChatView({ sessionId, onMenu, onClosePane }: { sessionId: string
|
||||
const el = scrollRef.current;
|
||||
if (el && stick.current) el.scrollTop = el.scrollHeight;
|
||||
});
|
||||
// … also when the pane gets smaller (on-screen keyboard opens) without a render.
|
||||
const hasSession = !!session;
|
||||
useEffect(() => {
|
||||
const el = scrollRef.current;
|
||||
if (!el || typeof ResizeObserver === "undefined") return;
|
||||
const ro = new ResizeObserver(() => {
|
||||
if (stick.current) el.scrollTop = el.scrollHeight;
|
||||
});
|
||||
ro.observe(el);
|
||||
return () => ro.disconnect();
|
||||
}, [hasSession, sessionId]);
|
||||
|
||||
if (loadError) return <div className="empty">{loadError}</div>;
|
||||
if (!session) return <div className="empty">{t("common.loading")}</div>;
|
||||
|
||||
Reference in new issue
Block a user