fix(desktop): only auto-scroll when user is near the bottom#41
Open
JackyCufe wants to merge 1 commit into
Open
fix(desktop): only auto-scroll when user is near the bottom#41JackyCufe wants to merge 1 commit into
JackyCufe wants to merge 1 commit into
Conversation
ChatPane unconditionally called scrollIntoView on every transcript change, yanking the user back to the bottom while they were reading history. Track scroll position with a ref: if the user is within 80px of the bottom, auto-scroll on new content; otherwise leave them where they are. Sending a new message always resets to bottom (the user's own action implies they want to see the response).
4bae0be to
b23ac46
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
ChatPane unconditionally called scrollIntoView on every transcript change, yanking the user back to the bottom while they were reading history. This made it impossible to scroll up and review earlier messages while the AI was still responding.
Fix
Track scroll position with a ref (atBottomRef). The auto-scroll effect now only fires when the user is within 80px of the bottom. If they have scrolled up to read history, new streaming content is appended without pulling them back down.
Sending a new message always resets to bottom — the user own action implies they want to see the response.
Verification
Files Changed