Skip to content

Preserve stop scroll decision on layout changes - #11067

Merged
imanolmzd-svg merged 1 commit into
mainfrom
imanol/prevent-scroll-stop
Jun 10, 2026
Merged

Preserve stop scroll decision on layout changes#11067
imanolmzd-svg merged 1 commit into
mainfrom
imanol/prevent-scroll-stop

Conversation

@imanolmzd-svg

@imanolmzd-svg imanolmzd-svg commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Part of #11030

Why

A conversation can have temporary resizes as components go from direct rendering to virtualized rendering. We had logic in place that would force auto-scrolling if the container didn't overflow, causing a scenario where a user would scroll up - A resize would happen - Be forced again to the bottom.

Implementation

Remove logic that automatically unpaused scroll when the container temporarily stopped overflowing. Previously, layout changes that reduced content height below the viewport would reset the userScrolled flag, causing the chat to jump back to the bottom when the user had intentionally scrolled up.

The stop/pause function now accepts a force parameter to bypass the canScroll check, ensuring an explicit user pause is never cleared by transient layout changes.

Screenshots / Video

This is one of the fixes for the intermittent issue shown in this video (Note the force scroll to bottom)

jump-down.mov

Correct behaviour

correct-scroll-up.mov

Testing

  • Manual testing
  • Unit tests
  • Typecheck

…w layouts

Remove logic that automatically unpaused scroll when the container
temporarily stopped overflowing. Previously, layout changes that reduced
content height below the viewport would reset the userScrolled flag,
causing the chat to jump back to the bottom when the user had
intentionally scrolled up.

The stop/pause function now accepts a force parameter to bypass the
canScroll check, ensuring an explicit user pause is never cleared by
transient layout changes.
@kilo-code-bot

kilo-code-bot Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

The fix is correct. All four !canScroll(el) branches that previously reset userScrolled → false now simply return without touching state, preventing transient layout changes (container temporarily stops overflowing during virtualized rendering) from clearing an intentional user scroll pause.

The force parameter on stop is a clean addition — pause: () => stop(true) correctly lets session restoration set the pause flag even on short content that hasn't yet overflowed, while the default force=false path used by handleWheel still guards against spurious pauses on non-scrollable content (verified by the new "does not pause for an upward wheel on short content" test).

The new tests cover all the key cases and test real implementation behaviour.

Files Reviewed (3 files)
  • .changeset/preserve-chat-scroll-pause.md
  • packages/kilo-ui/src/hooks/create-auto-scroll.tsx
  • packages/kilo-ui/src/hooks/create-auto-scroll.test.tsx

Reviewed by claude-sonnet-4.6 · 256,312 tokens

Review guidance: REVIEW.md from base branch main

@imanolmzd-svg
imanolmzd-svg merged commit b98fb9a into main Jun 10, 2026
20 checks passed
@imanolmzd-svg
imanolmzd-svg deleted the imanol/prevent-scroll-stop branch June 10, 2026 11:51
t7tran pushed a commit to t7tran/kilocode that referenced this pull request Aug 14, 2026
…w layouts (Kilo-Org#11067)

Remove logic that automatically unpaused scroll when the container
temporarily stopped overflowing. Previously, layout changes that reduced
content height below the viewport would reset the userScrolled flag,
causing the chat to jump back to the bottom when the user had
intentionally scrolled up.

The stop/pause function now accepts a force parameter to bypass the
canScroll check, ensuring an explicit user pause is never cleared by
transient layout changes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants