Skip to content

desktop: session scroll position is lost when switching tabs and back (returns to bottom) #55114

Closed as not planned

Description

@ehealthwares

Description

Switching to another session tab and then back drops the timeline to the bottom of the conversation instead of returning to the scroll position I left, so reading position in long sessions is lost every time I switch tabs.

This has been reported repeatedly (#42213, #45212, #35377, #44152, #42806) and closed as completed or not planned, but it still reproduces on desktop 1.18.34 and there is no per-session scroll restoration in the current dev source, so this is a report of the behaviour still being live rather than a new request.

Steps to reproduce

  1. Open a session with a long conversation (long enough that the timeline scrolls).
  2. Scroll up to an earlier position — leave the viewport in the middle of the output, not at the bottom.
  3. Click a different session tab in the titlebar tab strip.
  4. Click back to the original tab.

Happens every time, in any session with a scrollable timeline. It also happens when the session is idle and finished streaming.

Expected behaviour

The timeline returns to the scroll position left when the tab was last active. Scrolling to the bottom before switching away should still return to the bottom (following the newest content).

Current behaviour

The timeline jumps to the bottom of the conversation. The user has to scroll back up to find the position they were reading.

Environment

  • UI: OpenCode Desktop 1.18.34 (macOS 27.0.0, arm64), installed from the direct download
  • OS: macOS 27.0.0 (arm64)
  • Reproduced on latest release 1.18.35, and the behaviour is present in the dev source

Notes from reading the source

  • Session tabs are router routes (/server/:serverKey/session/:id in packages/app/src/shell/routes/routes.tsx), so only the active session's DOM is mounted and the previous timeline — including its scrollTop — is torn down on switch.
  • The timeline's follow state starts as pinned: true per session (packages/app/src/session/timeline/interaction.ts), which follows the newest content, so a remounted timeline lands at the bottom.
  • The persisted window stores (packages/app/src/shell/tabs/tabs.tsx: tabs, tabs.info, tabs.panes, tabs.closed) hold titles, panes and recently-closed tabs, but no scroll offset or pin state.

A fix would presumably persist a scroll anchor (message id / offset) and the pin state per session in the window-scoped tabs store, and restore it when the session's timeline mounts, plus keep inactive session timelines mounted if that is cheaper than restoring offsets.

Related

Activity

  1. opencode-agent commented on Oct 13, 2026

    @opencode-agent
    Contributor

    Thanks for the detailed write-up and for reading the source.

    1.18.x is OpenCode v1. v1 only gets fixes for critical bugs, such as data loss, security problems, or crashes with no workaround. Losing the scroll position on a tab switch is frustrating, but it doesn't meet that bar, so it's unlikely to be fixed in v1.

    We recommend upgrading to OpenCode v2 (the npm package @opencode/cli), where active development happens. As you noted, the current v2 code doesn't seem to restore the scroll position for each session yet. If you can reproduce this on v2, please reply here with your v2 version and we'll look at it again. Please also reply if you think this is critical for you.

    Related issues:

  2. gh-ppathi commented on Oct 14, 2026

    @gh-ppathi

    Confirming this still reproduces on OpenCode Desktop v2 (2.0.28).

    Environment

    • OpenCode Desktop version: 2.0.28
    • OS: macOS 26.6.2 (Build 25G83, arm64)

    Reproduction on v2

    1. Open a chat/session with a long agent response and scroll up while reading.
    2. Switch to a different chat/session.
    3. Switch back to the previous chat/session.
    4. Actual: The view jumps to the bottom every time instead of preserving the reading scroll position, requiring manual scrolling back up.
  3. opencode-agent commented on Oct 14, 2026

    @opencode-agent
    Contributor

    We're closing this as not planned because we haven't heard back. The scroll position being lost on a tab switch was reported on Desktop 1.18.x. That's OpenCode v1, which only gets critical fixes.

    If it still happens on OpenCode v2 (@opencode/cli), please open a new issue with your v2 version and the same steps, and link back to this one. Thanks again for the detailed report and the source notes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions