Skip to content

Pause chat auto-scroll on upward wheel over nested content - #11065

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

Pause chat auto-scroll on upward wheel over nested content#11065
imanolmzd-svg merged 1 commit into
mainfrom
imanol/nested-scroll-up

Conversation

@imanolmzd-svg

Copy link
Copy Markdown
Contributor

Part of #11030

Why

Scrolling within a nested container in the chat would create a quick moveup and down, disrupting the user scroll intention.

Implementation

We changed chat auto-scroll to prioritize explicit user intent (As opposed to position based).

Any upward wheel gesture within the conversation—including over nested tool outputs or code blocks—immediately pauses “follow bottom” via the existing stop() state.

We removed the previous data-scrollable exception and geometry-based ownership checks, because nested containers may not currently overflow or may be at a boundary. Auto-scroll resumes only through the existing resume action.

Screenshots / Video

Before

wiggle.mov

After

wiggle-fix.mov

Testing

  • Manual, as shown above
  • Unit tests
  • Typecheck

Remove the `isNested` helper that previously allowed upward scrolling
inside nested scrollable regions (tool output, code blocks) without
disabling auto-scroll. Now any upward wheel input anywhere in the
transcript immediately pauses auto-scroll, reflecting the user's intent
to review earlier content even when a nested region would consume the
event.

The wheel handler is registered with `capture: true` so it fires before
nested elements can intercept the event, and `markUser` no longer
triggers on wheel events since the capture handler handles that intent.
@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

Files Reviewed (3 files)
  • .changeset/fix-nested-chat-scroll.md
  • packages/kilo-ui/src/hooks/auto-scroll.ts
  • packages/kilo-ui/src/hooks/create-auto-scroll.tsx

Notes:

The fix is well-reasoned and the implementation is correct:

  • handleWheel now runs in capture phase ({ passive: true, capture: true }), ensuring it intercepts upward wheel events even when a nested element would stop propagation. The removeEventListener cleanup correctly mirrors the { capture: true } option.
  • markUser now early-returns for all WheelEvents. Wheel-driven pausing is handled exclusively by handleWheelstop(), which sets userScrolled = true synchronously. Subsequent resize observer and handleScroll callbacks both check store.userScrolled before any recentlyInteracted() path, so the removal of wheel events from lastInteraction tracking is safe.
  • Deletion of isNested / data-scrollable opt-in logic is intentional and removes the footgun described in the PR — nested containers may not overflow or may be at a boundary, making geometry checks unreliable.
  • Changeset is present and user-facing description is appropriate.

Reviewed by claude-4.6-sonnet-20260217 · 207,875 tokens

Review guidance: REVIEW.md from base branch main

@imanolmzd-svg
imanolmzd-svg merged commit 339c70a into main Jun 10, 2026
20 checks passed
@imanolmzd-svg
imanolmzd-svg deleted the imanol/nested-scroll-up branch June 10, 2026 10:53
t7tran pushed a commit to t7tran/kilocode that referenced this pull request Aug 14, 2026
…ilo-Org#11065)

Remove the `isNested` helper that previously allowed upward scrolling
inside nested scrollable regions (tool output, code blocks) without
disabling auto-scroll. Now any upward wheel input anywhere in the
transcript immediately pauses auto-scroll, reflecting the user's intent
to review earlier content even when a nested region would consume the
event.

The wheel handler is registered with `capture: true` so it fires before
nested elements can intercept the event, and `markUser` no longer
triggers on wheel events since the capture handler handles that intent.
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