From 4c2d8eedb0077eb0d787b5a499a46a23b020b8f3 Mon Sep 17 00:00:00 2001 From: Kenny Lee Date: Mon, 26 Jan 2026 16:33:56 -0800 Subject: [PATCH] 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 --- .../ClawdbotKit/Sources/ClawdbotChatUI/ChatView.swift | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/apps/shared/ClawdbotKit/Sources/ClawdbotChatUI/ChatView.swift b/apps/shared/ClawdbotKit/Sources/ClawdbotChatUI/ChatView.swift index 44399a3e6..bc8c3493e 100644 --- a/apps/shared/ClawdbotKit/Sources/ClawdbotChatUI/ChatView.swift +++ b/apps/shared/ClawdbotKit/Sources/ClawdbotChatUI/ChatView.swift @@ -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)) {