Overview
When a user is reading older messages in a room — either because they scrolled up or because they navigated to a historical message — a "Jump to Present" button appears, letting them return to the latest messages with one click. The button also surfaces context: it shows the date of the first visible message, and switches its label to "New messages" when new ones arrive while the user is scrolled away.
Behavior
- The button appears in two situations:
- Scrolled up from the bottom — the user manually scrolled away from the latest messages in a room that has enough history to overflow the viewport.
- Jumped mode — the user clicked a reply-attribution link, a search result, or a notification, and the room loaded a window of messages around that historical target.
- In either case, clicking the button cancels any pending scroll to an older message and returns the user to the latest messages.
- The button shows the date of the first visible message ("Yesterday | Jump to Present", "March 12 | Jump to Present").
- When new messages arrive while the user is scrolled up, the button label switches from "Jump to Present" to "New messages".
- The button auto-dismisses when the user is back near the bottom (within ~50px). In jumped mode, it also dismisses if the user has scrolled all the way to the bottom and all newer messages have loaded.
- The button fades in and out smoothly to avoid flicker.
- When the user opens a room or a thread with unread messages, the timeline shows the "New messages" separator at the top of the viewport. The button then shows, because the user is not at the latest messages. If all unread messages fit in the viewport, the timeline stays at the latest message. If the user opens the room or thread at a specific message, for example from a link, a search result, or a notification, the timeline shows that message instead.
- The "New messages" separator sits above the first message from another user after the read position. System rows, such as joins, and the user's own messages do not start it.
- When a message from another user arrives while the open room or thread is not in focus, the "New messages" separator appears above it at once. Later messages keep the separator in place. When the user returns, the read state from the server sets the separator again. When the user returns, the timeline scrolls to this separator as decision 6 describes.
Design Decisions
1. One button, two triggers
Decision: The "scrolled away" case and the "jumped mode" case share the same button UI and date display. Why: Behaviorally they're the same affordance — "I'm not looking at the latest, get me there". Two separate buttons would mean redundant UI and divergent logic for the same user need. Tradeoff: The click handler has to branch internally on which mode is active (scroll-to-bottom vs reload-latest). Acceptable; the modes are easy to distinguish.
2. Date display alongside the action
Decision: The button shows the date of the first visible message inline with the "Jump to Present" label. Why: When users are scrolled deep in history, the date is the most useful piece of context — "where am I in time, and how far is it to the present?". Adding it to the button keeps that context one glance away. Tradeoff: The button is wider than a pure-action button would be. Worth it; the date is a low-clutter element with high informational value.
3. "New messages" label when scrolled-away gets new traffic
Decision: When new messages arrive while the user is scrolled up, the button's label switches from "Jump to Present" to "New messages". Why: It's a stronger affordance than the badge-and-counter pattern: the same button the user was going to click anyway now carries an urgency signal. Reduces UI surface. Tradeoff: Users who don't realize "New messages" is the same button as "Jump to Present" might be briefly confused. The button position and date display stay constant, which mitigates this.
4. Jumped-mode exit reloads from the server
Decision: Clicking the button in jumped mode doesn't scroll — it reloads the latest page of messages from the server. Why: In jumped mode the loaded message window is a slice around the target message, with no guarantee that it extends to "now". Scrolling to the bottom of the loaded window would land somewhere arbitrary; the user actually wants to leave jumped mode entirely. Tradeoff: The click triggers a network request. In practice the latest page is usually small and the round-trip is fast.
5. Scroll-up lock against virtua corrections
Decision: A short (~150ms) lock prevents the message list's internal scroll-jump corrections from immediately re-enabling auto-scroll after a user scroll-up is detected. Why: Without it, the virtualized list's adjustments after a measurement update could be interpreted as the user scrolling down, immediately dismissing the button after the user just scrolled up. The lock filters out those self-induced movements. Tradeoff: Real user scroll-down within the lock window is briefly ignored. The window is short enough that this is imperceptible.
6. Open a room or thread at the first unread message
Decision: When the user opens a room or a thread, the timeline scrolls to the "New messages" separator when the separator first appears. This occurs one time for each entry. Opening a different thread is a new entry. A scroll, a jump to a message, a posted message, or a click on the button before the separator appears cancels it. An entry that targets a specific message does not scroll to the separator, also when the target message cannot be shown. A separator that appears while the user is away waits until the user returns. Until then, the timeline follows the latest message. Why: The user opens an unread room or thread to read the new messages, not only the latest one. A specific target message is a more precise request than the separator. The separator already marks the first unread message, so the timeline uses it as the landing position. Tradeoff: The separator position comes from the response to the entry read request. The timeline can show the latest messages for a short time and then move to the separator. The user's own action always has priority over this automatic movement. A separator that appears after this one-time scroll ran or was cancelled does not move the timeline.
7. Preserve position when older messages arrive
Decision: During older-page loading, keep the position from the end only when the loaded window changes at its start and keeps the same last event. New messages that arrive at the end during the request keep normal start anchoring. The timeline disables browser scroll anchoring so that only the virtualizer and the timeline's explicit scroll actions control the position. Why: A pending history request does not mean that every concurrent update adds older messages. Treating a new message as an older page can move the content that the user is reading. Tradeoff: This check does not treat window replacement or changes at both ends as a simple prepend.
8. Trim a long window that follows the latest message
Decision: When a room window follows the latest message and holds more than 500 events, the client removes its oldest events. It keeps at least the latest 300 events, and the kept window starts at a message. A window that shows older messages, a jumped window, and a thread are not trimmed. Removed messages that kept messages reply to stay available as reply previews. When the user scrolls up past the start of a trimmed window, the client reads the page around its first message and keeps the older events of that page. Then it continues with the cursor of that page. If that message is gone, the client tries the next kept message. Why: Without a limit, a room that stays open for days keeps every live message. Each new message, edit, or reaction then costs time for each kept row, and the client can become slow (issue #3852). Page cursors are opaque, so the client cannot make a cursor for the new start of the window. A read around a kept message gives a correct cursor without a change to the API. Tradeoff: The first older page after a trim needs a read around a message instead of a cursor read. This read occurs only when the user scrolls up. History that the user scrolled through earlier is read again.