Compare commits

...

2 commits

Author SHA1 Message Date
Blake Oliver
71468f02f2
Scroll to bottom of the lazyVStack when the keyboard opens / input field gains focus in dm and buffer views 2026-04-20 17:58:53 -06:00
Blake Oliver
6c404ba7fd
Run scroll to bottom in a task on the main actor for chat and dm buffer views
This should hopefully avoid the reported bug where a user can't scroll to with voiceover / presumably see their last message until sending another.
2026-04-20 17:56:03 -06:00
2 changed files with 16 additions and 2 deletions

View file

@ -38,9 +38,16 @@ struct ChatBufferView: View {
}
.padding()
}
.onChange(of: isInputFocused) { _, focused in
if focused, let last = messages.last {
proxy.scrollTo(last.persistentModelID, anchor: .bottom)
}
}
.onChange(of: messages.count) {
guard let last = messages.last, last.sessionId == manager.sessionId else { return }
proxy.scrollTo(last.persistentModelID, anchor: .bottom)
Task { @MainActor in
proxy.scrollTo(last.persistentModelID, anchor: .bottom)
}
let isActive = bufferName == manager.activeBuffer
let playBackground = UserDefaults.standard.bool(forKey: "sounds_background_buffers", default: true)

View file

@ -34,9 +34,16 @@ struct DMConversationView: View {
}
.padding()
}
.onChange(of: isInputFocused) { _, focused in
if focused, let last = messages.last {
proxy.scrollTo(last.persistentModelID, anchor: .bottom)
}
}
.onChange(of: messages.count) {
guard let last = messages.last, last.sessionId == manager.sessionId else { return }
proxy.scrollTo(last.persistentModelID, anchor: .bottom)
Task { @MainActor in
proxy.scrollTo(last.persistentModelID, anchor: .bottom)
}
// Sound
if UserDefaults.standard.bool(forKey: "sounds_enabled", default: true),