fix(macos): auto-scroll to bottom when sending message while scrolled up
When the user sends a message while reading older messages, scroll to bottom so they can see their sent message and the response. Fixes #2470 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
committed by
Gustavo Madeira Santana
parent
066b222b28
commit
4c2d8eedb0
@@ -132,6 +132,14 @@ public struct ClawdbotChatView: View {
|
||||
self.hasPerformedInitialScroll = false
|
||||
self.isPinnedToBottom = true
|
||||
}
|
||||
.onChange(of: self.viewModel.isSending) { _, isSending in
|
||||
// Scroll to bottom when user sends a message, even if scrolled up.
|
||||
guard isSending, self.hasPerformedInitialScroll else { return }
|
||||
self.isPinnedToBottom = true
|
||||
withAnimation(.snappy(duration: 0.22)) {
|
||||
self.scrollPosition = self.scrollerBottomID
|
||||
}
|
||||
}
|
||||
.onChange(of: self.viewModel.messages.count) { _, _ in
|
||||
guard self.hasPerformedInitialScroll, self.isPinnedToBottom else { return }
|
||||
withAnimation(.snappy(duration: 0.22)) {
|
||||
|
||||
Reference in New Issue
Block a user