diff --git a/src/app/features/room/RoomTimeline.tsx b/src/app/features/room/RoomTimeline.tsx index 6a48ff989..d44751aae 100644 --- a/src/app/features/room/RoomTimeline.tsx +++ b/src/app/features/room/RoomTimeline.tsx @@ -830,9 +830,17 @@ export function RoomTimeline({ useDocumentFocusChange( useCallback( (inFocus) => { - if (inFocus && atBottomState) tryAutoMarkAsRead(); + if (inFocus) { + if (atBottomState) tryAutoMarkAsRead(); + return; + } + // Re-anchor the divider at the last read when tabbing out while caught up. + if (atBottomState && timelineSync.liveTimelineLinked) { + readUptoEventIdRef.current = undefined; + setUnreadInfo(undefined); + } }, - [tryAutoMarkAsRead, atBottomState] + [tryAutoMarkAsRead, atBottomState, timelineSync.liveTimelineLinked, setUnreadInfo] ) );