Repository navigation
Description
Summary
In OpenCode Desktop, dragging the chat timeline scrollbar thumb makes it jump: the thumb position no longer matches the scroll offset, and the content jumps backwards/forwards while dragging. It happens once verticalScrollAdjustment becomes non-zero, which is normal during streaming when rows above the viewport resize.
Environment
- opencode version: 2.3.0 (OpenCode Desktop 2.3.0, CLI
opencode v2.3.0) - OS: Ubuntu 24.04.5 LTS, kernel 6.8.0-147-generic, X11 + KDE Plasma 5.27 (scale factor 1)
- Terminal: N/A (desktop app, Electron 44.9.1)
- Shell: /bin/bash
- Install/channel:
.debdesktop build,latestchannel,package-type=deb - Active plugins: none
Reproduction
- Open OpenCode Desktop and open a session with long chat history.
- Send a prompt that produces a long streaming answer, so the timeline virtualizer adjusts scroll offsets (
scrollAdjustmentbecomes non-zero). - Grab the vertical scrollbar thumb on the right and drag it up/down.
Expected Behavior
The thumb follows the pointer 1:1 and the content stays anchored to the thumb position.
Actual Behavior
The thumb jumps relative to the content: the scroll position lags or overshoots the pointer, so dragging feels like it "snaps". The further you drag, the bigger the offset. Dragging after the adjustment returns to 0 (e.g. after scrolling to the end) behaves correctly.
Additional Context
Root cause is in the ScrollView component (out/renderer/assets/main-CEQaLS28.js, function names $Z, helper w8t).
Thumb rendering accounts for verticalScrollAdjustment:
let t = verticalScrollAdjustment ?? 0
let r = scrollHeight + t
let i = Math.max(0, thumbContainer.clientHeight - 16)
let a = Math.min(i, Math.max(clientHeight / r * i, 32)) // thumb size
let s = r - clientHeight // scrollable range
let c = i - a
verticalThumbStart = 8 + (scrollTop + t) / s * cThumb dragging does not:
// w8t(position, trackLen, scrollHeight, thumbSize, clientHeight, rtl)
function w8t(e, t, n, r, i, a) {
let o = t - 16 - r
if (o <= 0) return 0
let s = Math.max(0, Math.min(e - 8, o))
return (a ? 1 - s / o : s / o) * Math.max(0, n - i)
}
// call site: n = viewport.scrollHeight, i = viewport.clientHeight, no adjustment
viewport.scrollTop = w8t(...)So rendering maps scrollTop + adjustment into the track, while dragging inverts only scrollTop. As soon as scrollAdjustment != 0, the two mappings differ and the thumb jumps.
Suggested fix (verified locally by patching the bundle, behaviour becomes correct):
const adj = vertical ? (props.verticalScrollAdjustment ?? 0) : 0
const pos = w8t(pointerPos, trackLen, vertical ? scrollHeight + adj : scrollWidth,
thumbSize, vertical ? clientHeight : clientWidth, rtl)
viewport.scrollTop = pos - adjNote: w8t's call site must pass the adjusted total length so the returned range equals (scrollHeight + adj) - clientHeight; subtracting adj afterwards converts it back to a real scrollTop.
Frequency: consistently reproducible whenever content above the viewport changes size (streaming answers, expanding/collapsing tool output, lazy-loaded markdown).
Workaround for users: scroll with the wheel or keyboard; the thumb is correct until it is dragged.
Activity
opencodejr commentedon Nov 15, 2026
Thanks for the detailed analysis! I couldn't run OpenCode Desktop here, so I haven't been able to reproduce the jump myself.
From reading the current
devsource (d432a06), the mismatch you point out is there. Inpackages/ui/src/components/scroll-view.tsx,updateThumbaddsverticalScrollAdjustmentwhen it places the thumb, butonThumbPointerMoveworks outscrollTopfrom the plainscrollHeightand doesn't take the adjustment into account.What I couldn't confirm is the trigger. In the timeline code I read, the adjustment only builds up while a touch or momentum scroll is in progress (the deferred iOS-style path). It is reset to 0 once scrolling settles, and pressing on the thumb ends that deferral. A maintainer with the desktop app will need to check when it actually shows up. It would help if you could say:
You can reply here with the details, or edit the issue and then leave a short comment saying you've updated it.