Fix savings chat autoscroll
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
---
|
||||
id: TASK-11
|
||||
title: Fix savings chat autoscroll after agent replies
|
||||
status: In Progress
|
||||
assignee: []
|
||||
created_date: '2026-06-16 09:00'
|
||||
updated_date: '2026-06-16 09:01'
|
||||
labels: []
|
||||
dependencies: []
|
||||
priority: high
|
||||
ordinal: 11000
|
||||
---
|
||||
|
||||
## Description
|
||||
|
||||
<!-- SECTION:DESCRIPTION:BEGIN -->
|
||||
Prevent the savings chat window from jumping to the first message when the agent appends a response. The chat viewport should stay scrolled to the newest message after message count or active session changes.
|
||||
<!-- SECTION:DESCRIPTION:END -->
|
||||
|
||||
## Acceptance Criteria
|
||||
<!-- AC:BEGIN -->
|
||||
- [x] #1 Chat autoscroll sets the scroll container to its bottom instead of calling scrollIntoView on an inner wrapper
|
||||
- [x] #2 A regression test covers the scroll-to-bottom helper behavior
|
||||
- [x] #3 Focused chat tests and build pass
|
||||
<!-- AC:END -->
|
||||
|
||||
## Implementation Plan
|
||||
|
||||
<!-- SECTION:PLAN:BEGIN -->
|
||||
1. Confirm current scroll path and root cause.
|
||||
2. Add failing AgentChat model test for direct scroll-container bottoming.
|
||||
3. Replace scrollIntoView on inner wrapper with direct scrollTop assignment on the conversation container.
|
||||
4. Run focused tests, targeted lint, and build.
|
||||
5. Commit the fix; keep task In Progress until user confirms manual behavior.
|
||||
<!-- SECTION:PLAN:END -->
|
||||
|
||||
## Implementation Notes
|
||||
|
||||
<!-- SECTION:NOTES:BEGIN -->
|
||||
Root cause: SavingsChatPage used listRef.current.lastElementChild.scrollIntoView after AgentConversation moved the ref to the scroll container. The last child is the inner wrapper, so browser alignment can jump to the top of the chat content. Fixed by setting the scroll container scrollTop to scrollHeight via scrollConversationToBottom. Verification passed: npx vitest src/components/chat/AgentChat.test.tsx --run (12 tests), targeted eslint, npm run build (existing Vite chunk-size warning only).
|
||||
<!-- SECTION:NOTES:END -->
|
||||
Reference in New Issue
Block a user