mirror of
https://github.com/anomalyco/opentui.git
synced 2026-04-25 13:06:00 +03:00
[GH-ISSUE #530] ScrollBox _hasManualScroll is never reset, breaking stickyScroll behavior #139
Labels
No labels
bug
core
documentation
feature
good first issue
help wanted
pull-request
question
react
solid
tmux
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/opentui#139
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @bradleat on GitHub (Jan 15, 2026).
Original GitHub issue: https://github.com/anomalyco/opentui/issues/530
Description
When using a
ScrollBoxwithstickyScroll={true}andstickyStart="bottom", the sticky scroll behavior permanently breaks after the user scrolls manually. The scroll unexpectedly jumps to the top instead of staying at the bottom when new content is added.Steps to Reproduce
stickyScroll={true}andstickyStart="bottom"Expected: Scroll stays at bottom (sticky behavior re-engages)
Actual: Scroll jumps to top randomly
Root Cause
In
ScrollBoxRenderable, the_hasManualScrollflag is set totruein 7 different places but is never reset tofalse:Once
_hasManualScrollistrue,recalculateBarProps()skipsapplyStickyStart():The bug manifests when:
updateStickyState()sets_stickyScrollTop = true_hasManualScroll = trueProposed Fix
Reset
_hasManualScroll = falsewhen the user scrolls back to the sticky position. InupdateStickyState():This allows sticky scroll to re-engage naturally when the user scrolls back to the designated sticky position.
Environment
@opentui/core: 0.1.72@bradleat commented on GitHub (Jan 15, 2026):
Updated Fix
After further testing, I found an edge case in my original proposed fix. When content is smaller than the viewport (
maxScrollTop === 0), bothscrollTop <= 0andscrollTop >= maxScrollTopare true. The code hits the first branch, setting_stickyScrollTop = trueeven whenstickyStart="bottom".The fix needs to account for this - when content fits in the viewport, we're effectively at both top and bottom:
I've tested this fix locally and it resolves the scroll-jump-to-top issue in our terminal emulator.
cmd-v#800