Skip to content

Conversation

continue[bot]
Copy link
Contributor

@continue continue bot commented Sep 18, 2025

This PR fixes the auto-scroll issue where the chat would fail to stay anchored to the bottom when components dynamically appear in the chat (e.g., tool outputs, inline elements).

Changes

  • Added MutationObserver to detect when new DOM elements are added to the chat
  • Changed from observing only direct children to observing all descendants using
  • New elements and their children are automatically observed when added to ensure ResizeObserver catches their size changes
  • Added option to MutationObserver to watch all levels of the DOM tree

Problem Solved

Previously, the auto-scroll only observed immediate children of the chat container. When components like tool outputs or other inline elements were dynamically added, they weren't being observed by the ResizeObserver, so their height changes didn't trigger the auto-scroll behavior. This fix ensures all dynamically added elements are observed, maintaining the anchor-to-bottom behavior even when complex components pop into the chat.


Summary by cubic

Keep the chat anchored to the bottom when dynamic components (tool outputs, inline elements) are added.

  • Bug Fixes
    • Added a MutationObserver with subtree: true to detect newly added nodes.
    • ResizeObserver now observes the container and all descendants; newly added nodes and their children are auto-observed.
    • Disconnect observers on cleanup and retain the scroll handler.

- Added MutationObserver to watch for dynamically added DOM elements
- Changed from observing only direct children to observing all descendants
- New elements and their children are automatically observed when added
- This ensures auto-scroll works when components pop into the chat, not just text

Generated with [Continue](https://continue.dev)

Co-Authored-By: Continue <noreply@continue.dev>
@continue continue bot requested a review from a team as a code owner September 18, 2025 00:04
@continue continue bot requested review from Patrick-Erichsen and removed request for a team September 18, 2025 00:04
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Sep 18, 2025
Copy link

⚠️ PR Title Format

Your PR title doesn't follow the conventional commit format, but this won't block your PR from being merged. We recommend using this format for better project organization.

Expected Format:

<type>[optional scope]: <description>

Examples:

  • feat: add changelog generation support
  • fix: resolve login redirect issue
  • docs: update README with new instructions
  • chore: update dependencies

Valid Types:

feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert

This helps with:

  • 📝 Automatic changelog generation
  • 🚀 Automated semantic versioning
  • 📊 Better project history tracking

This is a non-blocking warning - your PR can still be merged without fixing this.

@RomneyDa RomneyDa marked this pull request as draft September 18, 2025 18:41
@RomneyDa RomneyDa marked this pull request as ready for review September 26, 2025 18:29
@RomneyDa
Copy link
Collaborator

@Patrick-Erichsen I can do a preliminary review, I kicked this off

@chezsmithy
Copy link
Contributor

Possible fix for #8004 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:M This PR changes 30-99 lines, ignoring generated files.
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

3 participants