From ff9d15f9307f65a65f524b72efadd7194eabb988 Mon Sep 17 00:00:00 2001 From: heaven Date: Sat, 25 Apr 2026 12:35:02 +0300 Subject: [PATCH] Auto-scroll chat timeline to bottom when Android keyboard opens. --- index.html | 2 +- src/app/features/room/RoomTimeline.tsx | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index a73705e3..e0d86df3 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ - + Vojo diff --git a/src/app/features/room/RoomTimeline.tsx b/src/app/features/room/RoomTimeline.tsx index e44fba6a..fc8e8cfb 100644 --- a/src/app/features/room/RoomTimeline.tsx +++ b/src/app/features/room/RoomTimeline.tsx @@ -707,6 +707,26 @@ export function RoomTimeline({ room, eventId, roomInputRef, editor }: RoomTimeli useCallback(() => roomInputRef.current, [roomInputRef]) ); + // Stay at bottom when scroll container resizes (e.g. Android keyboard open/close) + useResizeObserver( + useMemo(() => { + let mounted = false; + return (_entries: ResizeObserverEntry[]) => { + if (!mounted) { + mounted = true; + return; + } + if (atBottomRef.current) { + requestAnimationFrame(() => { + const el = getScrollElement(); + if (el) scrollToBottom(el); + }); + } + }; + }, [getScrollElement]), + getScrollElement + ); + const tryAutoMarkAsRead = useCallback(() => { const readUptoEventId = readUptoEventIdRef.current; if (!readUptoEventId) {