Skip to content

Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.

fix(apps): keep conversations stable around the keyboard

leepokai5c0673898db8
diff --git a/apps/android/app/src/androidTest/kotlin/com/codync/android/ConversationKeyboardTest.kt b/apps/android/app/src/androidTest/kotlin/com/codync/android/ConversationKeyboardTest.kt
new file mode 100644
index 00000000..c97fa1bb
--- /dev/null
+++ b/apps/android/app/src/androidTest/kotlin/com/codync/android/ConversationKeyboardTest.kt
@@ -0,0 +1,41 @@
+package com.codync.android
+
+import androidx.activity.compose.setContent
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.PaddingValues
+import androidx.compose.foundation.text.BasicTextField
+import androidx.compose.material3.Text
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.platform.testTag
+import androidx.compose.ui.test.*
+import androidx.compose.ui.test.junit4.createAndroidComposeRule
+import androidx.compose.ui.unit.dp
+import com.codync.android.design.LinkButton
+import org.junit.Rule
+import org.junit.Test
+
+class ConversationKeyboardTest {
+ @get:Rule val compose = createAndroidComposeRule<MainActivity>()
+
+ @Test fun conversationTapClearsFocusButButtonTapKeepsIt() {
+ compose.activity.setContent {
+ Hosted {
+ Column {
+ val draft = remember { mutableStateOf("Draft") }
+ BasicTextField(draft.value, { draft.value = it }, Modifier.testTag("composer"))
+ ConversationList("message", 1, false, PaddingValues(0.dp)) {
+ item { Text("Conversation background") }
+ item { LinkButton("Keep editing", action = {}) }
+ }
+ }
+ }
+ }
+ compose.onNodeWithTag("composer").performClick().assertIsFocused()
+ compose.onNodeWithText("Keep editing").performTouchInput { click() }
+ compose.onNodeWithTag("composer").assertIsFocused()
+ compose.onNodeWithText("Conversation background").performTouchInput { click() }
+ compose.onNodeWithTag("composer").assertIsNotFocused().assertTextEquals("Draft")
+ }
+}
diff --git a/apps/android/app/src/main/kotlin/com/codync/android/ChatRows.kt b/apps/android/app/src/main/kotlin/com/codync/android/ChatRows.kt
index 64cb0546..83c66f82 100644
--- a/apps/android/app/src/main/kotlin/com/codync/android/ChatRows.kt
+++ b/apps/android/app/src/main/kotlin/com/codync/android/ChatRows.kt
@@ -30,6 +30,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
+import androidx.compose.ui.platform.LocalFocusManager
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.semantics.clearAndSetSemantics
import androidx.compose.ui.semantics.contentDescription
@@ -166,12 +167,13 @@ internal val Entry.reactions: List<String> get() = (data["reactions"] as? JsonAr
@Composable private fun UserBubble(entry: Entry, state: AppState, store: AppStore, reply: (() -> Unit)?) {
val context = LocalContext.current
+ val focus = LocalFocusManager.current
val attachments = entry.data["attachments"]?.jsonArray?.map { WireJson.decodeFromJsonElement<Attachment>(it) }.orEmpty()
Column(Modifier.fillMaxWidth().padding(start = 56.dp), horizontalAlignment = Alignment.End, verticalArrangement = Arrangement.spacedBy(4.dp)) {
if (attachments.isNotEmpty()) AttachmentList(attachments, entry.botId, state, store)
val quote = entry.replyTo
if (entry.text.isNotEmpty() || quote != null) Box(Modifier.clip(RoundedRectangle(18.dp)).background(Palette.bubbleUser)
- .contextActions(reactions = reactionPick(entry, store), preview = { SelectionContainer { UserText(entry.text, quote) } }) {
+ .contextActions(reactions = reactionPick(entry, store), onClick = { focus.clearFocus() }, preview = { SelectionContainer { UserText(entry.text, quote) } }) {
messageMenu(context, entry, reply, null)
}) { UserText(entry.text, quote) }
SendStatusLine(entry.status, state.bots.firstOrNull { it.id == entry.botId }?.status == "working")
@@ -236,14 +238,15 @@ internal val Entry.reactions: List<String> get() = (data["reactions"] as? JsonAr
@Composable private fun AgentBubble(entry: Entry, state: AppState, store: AppStore, openTrace: () -> Unit, reply: (() -> Unit)?) {
val context = LocalContext.current
+ val focus = LocalFocusManager.current
val files = entry.files
Column(Modifier.fillMaxWidth().padding(end = 40.dp), verticalArrangement = Arrangement.spacedBy(4.dp)) {
// A message with files is its files: the text is only the computer's fallback.
- if (files.isNotEmpty()) Column(Modifier.contextActions(reactions = reactionPick(entry, store)) { messageMenu(context, entry, reply, openTrace) },
+ if (files.isNotEmpty()) Column(Modifier.contextActions(reactions = reactionPick(entry, store), onClick = { focus.clearFocus() }) { messageMenu(context, entry, reply, openTrace) },
verticalArrangement = Arrangement.spacedBy(4.dp)) {
for (file in files) FileDownloadCard(entry, file, state, store)
} else if (entry.text.isNotEmpty()) Box(Modifier.clip(RoundedRectangle(18.dp)).background(Palette.bubbleAgent)
- .contextActions(reactions = reactionPick(entry, store), preview = { AgentText(entry.text, selectable = true) }) {
+ .contextActions(reactions = reactionPick(entry, store), onClick = { focus.clearFocus() }, preview = { AgentText(entry.text, selectable = true) }) {
messageMenu(context, entry, reply, openTrace)
}) { AgentText(entry.text, selectable = false) }
}
@@ -396,4 +399,4 @@ internal val Entry.botReactions: Map<String, List<String>> get() =
}
}
-internal fun JsonObject.text(key: String): String? = this[key]?.jsonPrimitive?.contentOrNull
\ No newline at end of file
+internal fun JsonObject.text(key: String): String? = this[key]?.jsonPrimitive?.contentOrNull
diff --git a/apps/android/app/src/main/kotlin/com/codync/android/ConversationList.kt b/apps/android/app/src/main/kotlin/com/codync/android/ConversationList.kt
index 7abca01d..027408fe 100644
--- a/apps/android/app/src/main/kotlin/com/codync/android/ConversationList.kt
+++ b/apps/android/app/src/main/kotlin/com/codync/android/ConversationList.kt
@@ -7,6 +7,7 @@ import androidx.compose.animation.scaleIn
import androidx.compose.animation.scaleOut
import androidx.compose.foundation.background
import androidx.compose.foundation.gestures.animateScrollBy
+import androidx.compose.foundation.gestures.detectTapGestures
import androidx.compose.foundation.interaction.DragInteraction
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.PaddingValues
@@ -28,6 +29,8 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.shadow
import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.input.pointer.pointerInput
+import androidx.compose.ui.platform.LocalFocusManager
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import com.codync.android.design.*
@@ -45,7 +48,11 @@ import kotlinx.coroutines.launch
val bottom = padding.calculateBottomPadding()
val following = rememberFollowing(list, last, rev, working, bottom)
val scope = rememberCoroutineScope()
- Box(Modifier.fillMaxSize()) {
+ val focus = LocalFocusManager.current
+ // Child controls consume their taps; only a plain conversation tap clears the composer.
+ Box(Modifier.fillMaxSize().pointerInput(focus) {
+ detectTapGestures { focus.clearFocus() }
+ }) {
if (refresh == null) LazyColumn(Modifier.fillMaxSize(), state = list, contentPadding = padding, content = content)
else PullToRefresh(refresh, Modifier.fillMaxSize(), indicatorTop) {
LazyColumn(Modifier.fillMaxSize(), state = list, contentPadding = padding, content = content)
diff --git a/apps/ios/Kit/Sources/CodyncUI/Platform.swift b/apps/ios/Kit/Sources/CodyncUI/Platform.swift
index e06eb2ea..14f18c53 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Platform.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Platform.swift
@@ -25,12 +25,3 @@ extension View {
}
}
}
-
-extension View {
- /// Floating surfaces over the chat (Jump to latest): a dark frosted fill that lets the chat
- /// show through faintly, not Liquid Glass's clear lens. No border: the fill carries the edge.
- func frosted(in shape: some Shape) -> some View {
- background(Color(light: 0xF4F4F4, dark: 0x232323).opacity(0.82), in: shape)
- .background(.ultraThinMaterial, in: shape)
- }
-}
diff --git a/apps/ios/Kit/Sources/CodyncUI/Thread/ConversationCollectionView.swift b/apps/ios/Kit/Sources/CodyncUI/Thread/ConversationCollectionView.swift
index f6d6da02..507fc0a8 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Thread/ConversationCollectionView.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Thread/ConversationCollectionView.swift
@@ -2,17 +2,45 @@ import UIKit
/// Only one owner moves the list: the reader, a jump animation, or passive end-following.
class ConversationCollectionView: UICollectionView {
+ let keyboardDismissTapDelegate = ConversationBackgroundTapDelegate()
static let nearEnd: CGFloat = 32
- var following = true
+ var following = true {
+ didSet { if !following { needsViewportFollow = false } }
+ }
+ private(set) var updatingViewport = false
+ private var needsViewportFollow = false
private(set) var scrollingToEnd = false
private var displayLink: CADisplayLink?
private var lastFrame: TimeInterval?
private var motion = ConversationScrollMotion()
+ @objc func dismissComposerKeyboard() {
+ // The composer is a sibling of the collection, not one of its descendants.
+ window?.endEditing(true)
+ }
+
var endOffset: CGFloat {
max(contentSize.height + adjustedContentInset.bottom - bounds.height, -adjustedContentInset.top)
}
+ /// Keyboard/composer layout is one change: intermediate offsets aren't reader scrolling.
+ func updateViewport(frame: CGRect, insets: UIEdgeInsets, indicators: UIEdgeInsets) {
+ guard self.frame != frame || contentInset != insets else { return }
+ updatingViewport = true
+ defer { updatingViewport = false }
+ if following { needsViewportFollow = true }
+ self.frame = frame
+ contentInset = insets
+ verticalScrollIndicatorInsets = indicators
+ layoutIfNeeded()
+ if following { pinToEnd() }
+ if needsViewportFollow, window != nil { startFrames() }
+ }
+
+ func followingAfterInteraction() -> Bool {
+ (following && needsViewportFollow) || endOffset - contentOffset.y < Self.nearEnd
+ }
+
override func layoutSubviews() {
super.layoutSubviews()
if following { pinToEnd() }
@@ -21,11 +49,13 @@ class ConversationCollectionView: UICollectionView {
override func didMoveToWindow() {
super.didMoveToWindow()
if window == nil { cancelScrollingToEnd() }
+ else if needsViewportFollow { startFrames() }
}
func pinToEnd() {
// Every caller must yield to UIKit until the drag and its rubber-band return finish.
guard !scrollingToEnd, !isTracking, !isDragging, !isDecelerating else { return }
+ needsViewportFollow = false
let end = endOffset
if abs(contentOffset.y - end) > 0.5 { contentOffset.y = end }
}
@@ -57,6 +87,10 @@ class ConversationCollectionView: UICollectionView {
return pinToEnd()
}
scrollingToEnd = true
+ startFrames()
+ }
+
+ private func startFrames() {
// Repeated requests retarget the existing motion; they never rewind or restart it.
guard displayLink == nil else { return }
motion = ConversationScrollMotion()
@@ -74,6 +108,14 @@ class ConversationCollectionView: UICollectionView {
}
fileprivate func advance(_ link: CADisplayLink) {
+ // A stationary touch has no drag-end callback. Resume viewport following once UIKit
+ // releases it, without moving the content while a touch or deceleration owns it.
+ if !scrollingToEnd {
+ guard following, needsViewportFollow else { return cancelScrollingToEnd() }
+ pinToEnd()
+ if !needsViewportFollow { cancelScrollingToEnd() }
+ return
+ }
guard following, !isTracking, !isDecelerating else { return cancelScrollingToEnd() }
// Measure only the current viewport. Do not jump offscreen to pre-size estimated rows.
layoutIfNeeded()
@@ -100,3 +142,10 @@ class ConversationCollectionView: UICollectionView {
view.advance(link)
}
}
+
+/// Keep tap filtering off the scroll view, which also delegates its own pan gesture.
+final class ConversationBackgroundTapDelegate: NSObject, UIGestureRecognizerDelegate {
+ func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldReceive touch: UITouch) -> Bool {
+ touch.view === gestureRecognizer.view
+ }
+}
diff --git a/apps/ios/Kit/Sources/CodyncUI/Thread/ConversationList.swift b/apps/ios/Kit/Sources/CodyncUI/Thread/ConversationList.swift
index 244c0c92..f88cdb17 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Thread/ConversationList.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Thread/ConversationList.swift
@@ -104,16 +104,19 @@ private struct ConversationCollection: UIViewRepresentable {
view.allowsSelection = false
view.delegate = self
if #available(iOS 26, *) { view.topEdgeEffect.style = .soft }
- // Tapping the conversation puts the keyboard away; the rows still get the tap.
- let tap = UITapGestureRecognizer(target: view, action: #selector(UIView.endEditing(_:)))
+ // Only the empty collection background; hosted rows arbitrate their own taps.
+ let tap = UITapGestureRecognizer(target: view, action: #selector(ConversationCollectionView.dismissComposerKeyboard))
tap.cancelsTouchesInView = false
+ tap.delegate = view.keyboardDismissTapDelegate
view.addGestureRecognizer(tap)
- let cell = UICollectionView.CellRegistration<UICollectionViewCell, String> { [weak self] cell, _, id in
+ let cell = UICollectionView.CellRegistration<UICollectionViewCell, String> { [weak self, weak view] cell, _, id in
guard let self else { return }
cell.backgroundConfiguration = .clear()
- cell.contentConfiguration = UIHostingConfiguration {
+ cell.contentConfiguration = UIHostingConfiguration { [weak view] in
ConversationCell(content: contents[id] ?? AnyView(EmptyView()))
+ .contentShape(Rectangle())
+ .onTapGesture { [weak view] in view?.dismissComposerKeyboard() }
.environment(\.self, environment)
// A reused cell starts fresh (no state carried over from another row).
.id(id)
@@ -225,7 +228,7 @@ private struct ConversationCollection: UIViewRepresentable {
defer { lastOffset = y }
trackPull(scrollView)
// Only the reader's own scrolling changes following; layout never does.
- guard scrollView.isTracking || scrollView.isDecelerating else { return }
+ guard !view.updatingViewport, scrollView.isTracking || scrollView.isDecelerating else { return }
setFollowing(view.followingAfterScroll(from: lastOffset))
if !view.following, y + scrollView.adjustedContentInset.top < scrollView.bounds.height / 2 {
parent?.nearTop?()
@@ -307,7 +310,7 @@ private struct ConversationCollection: UIViewRepresentable {
/// The reader stopped scrolling: resting at the end follows again; anywhere else stays put.
private func settle() {
- setFollowing(view.endOffset - view.contentOffset.y < ConversationCollectionView.nearEnd)
+ setFollowing(view.followingAfterInteraction())
if view.following { view.pinToEnd() }
}
}
@@ -361,13 +364,9 @@ private final class ConversationContainer: UIView {
override func layoutSubviews() {
super.layoutSubviews()
- list.frame = bounds.inset(by: UIEdgeInsets(top: -outsets.top, left: 0, bottom: -outsets.bottom, right: 0))
+ let frame = bounds.inset(by: UIEdgeInsets(top: -outsets.top, left: 0, bottom: -outsets.bottom, right: 0))
let insets = UIEdgeInsets(top: outsets.top + hold, left: 0, bottom: outsets.bottom, right: 0)
- if list.contentInset != insets {
- list.contentInset = insets
- list.verticalScrollIndicatorInsets = outsets
- if list.following { list.pinToEnd() }
- }
+ list.updateViewport(frame: frame, insets: insets, indicators: outsets)
}
override func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
@@ -394,11 +393,7 @@ struct JumpToLatest: View {
var body: some View {
ZStack {
if visible {
- Button("Jump to latest", systemImage: "arrow.down", action: action)
- .labelStyle(.iconOnly)
- .buttonStyle(IconButtonStyle())
- .frosted(in: Circle())
- .shadow(color: .black.opacity(0.12), radius: 10, y: 3)
+ jumpButton
.help("Jump to latest")
.padding(.bottom, 10)
.transition(.scale(scale: 0.8).combined(with: .opacity))
@@ -406,4 +401,20 @@ struct JumpToLatest: View {
}
.animation(Motion.reduced(Motion.layout, reduceMotion), value: visible)
}
+
+ @ViewBuilder private var jumpButton: some View {
+ if #available(iOS 26, *) {
+ Button("Jump to latest", systemImage: "arrow.down", action: action)
+ .labelStyle(.iconOnly)
+ .font(.system(size: 18, weight: .medium))
+ .controlSize(.large)
+ .buttonStyle(.glass)
+ .buttonBorderShape(.circle)
+ } else {
+ Button("Jump to latest", systemImage: "arrow.down", action: action)
+ .labelStyle(.iconOnly)
+ .buttonStyle(IconButtonStyle())
+ .glass(in: Circle())
+ }
+ }
}
diff --git a/apps/ios/Kit/Tests/CodyncUITests/ConversationKeyboardTests.swift b/apps/ios/Kit/Tests/CodyncUITests/ConversationKeyboardTests.swift
new file mode 100644
index 00000000..44cc2009
--- /dev/null
+++ b/apps/ios/Kit/Tests/CodyncUITests/ConversationKeyboardTests.swift
@@ -0,0 +1,26 @@
+import Testing
+import UIKit
+@testable import CodyncUI
+
+@MainActor @Test func tappingConversationEndsEditingInSiblingComposer() {
+ let window = UIWindow(frame: CGRect(x: 0, y: 0, width: 320, height: 640))
+ let controller = UIViewController()
+ window.rootViewController = controller
+ let conversation = ConversationCollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout())
+ let composer = UITextView(frame: CGRect(x: 0, y: 500, width: 320, height: 80))
+ controller.view.addSubview(conversation)
+ controller.view.addSubview(composer)
+ window.makeKeyAndVisible()
+ defer { window.isHidden = true }
+ composer.becomeFirstResponder()
+ #expect(composer.isFirstResponder)
+
+ conversation.dismissComposerKeyboard()
+
+ #expect(!composer.isFirstResponder)
+}
+
+@MainActor @Test func keyboardTapFilteringDoesNotOverrideScrollGestureDelegate() {
+ let conversation = ConversationCollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout())
+ #expect(conversation.keyboardDismissTapDelegate !== conversation.panGestureRecognizer.delegate)
+}
diff --git a/apps/ios/Kit/Tests/CodyncUITests/ConversationViewportTests.swift b/apps/ios/Kit/Tests/CodyncUITests/ConversationViewportTests.swift
new file mode 100644
index 00000000..73d5b49b
--- /dev/null
+++ b/apps/ios/Kit/Tests/CodyncUITests/ConversationViewportTests.swift
@@ -0,0 +1,102 @@
+import SwiftUI
+import Testing
+import UIKit
+@testable import CodyncUI
+
+@MainActor @Test func keyboardSafeAreaKeepsTheLatestMessageVisible() async throws {
+ let window = UIWindow(frame: CGRect(x: 0, y: 0, width: 390, height: 844))
+ let rows = (0..<30).map { index in
+ ConversationRow("\(index)") { Text("Message \(index)").frame(height: 60) }
+ }
+ let host = UIHostingController(rootView: ConversationList(rows: rows, following: .constant(true))
+ .safeAreaInset(edge: .bottom) { Color.clear.frame(height: 60) })
+ window.rootViewController = host
+ window.makeKeyAndVisible()
+ defer { window.isHidden = true }
+ try await Task.sleep(for: .milliseconds(300))
+ let list = try #require(findConversation(in: host.view))
+ let previousHeight = list.bounds.height - list.adjustedContentInset.top - list.adjustedContentInset.bottom
+ host.additionalSafeAreaInsets.bottom = 300
+ host.view.setNeedsLayout()
+ host.view.layoutIfNeeded()
+ try await Task.sleep(for: .milliseconds(300))
+ #expect(list.following)
+ #expect(abs(list.contentOffset.y - list.endOffset) < 1)
+ #expect(abs(previousHeight - (list.bounds.height - list.adjustedContentInset.top - list.adjustedContentInset.bottom) - 300) < 1)
+}
+
+@MainActor private func findConversation(in view: UIView) -> ConversationCollectionView? {
+ if let list = view as? ConversationCollectionView { return list }
+ return view.subviews.lazy.compactMap { findConversation(in: $0) }.first
+}
+
+@MainActor @Test func keyboardResizeDuringTouchKeepsFollowingWhenTheTouchEnds() {
+ let list = ViewportConversationView(frame: CGRect(x: 0, y: 0, width: 390, height: 700),
+ collectionViewLayout: ViewportConversationLayout())
+ list.layoutIfNeeded()
+ list.contentSize = CGSize(width: 390, height: 2_000)
+ list.pinToEnd()
+ list.simulatingTouch = true
+ list.updateViewport(frame: list.frame, insets: UIEdgeInsets(top: 0, left: 0, bottom: 300, right: 0), indicators: .zero)
+ #expect(list.followingAfterInteraction())
+ list.simulatingTouch = false
+ list.following = list.followingAfterInteraction()
+ list.pinToEnd()
+ #expect(abs(list.contentOffset.y - list.endOffset) < 1)
+}
+
+@MainActor @Test func keyboardResizePreservesAnOlderMessageBeingRead() {
+ let list = ViewportConversationView(frame: CGRect(x: 0, y: 0, width: 390, height: 700),
+ collectionViewLayout: ViewportConversationLayout())
+ list.following = false
+ list.layoutIfNeeded()
+ list.contentSize = CGSize(width: 390, height: 2_000)
+ list.contentOffset.y = 400
+ list.updateViewport(frame: list.frame, insets: UIEdgeInsets(top: 0, left: 0, bottom: 300, right: 0), indicators: .zero)
+ #expect(list.contentOffset.y == 400)
+ #expect(!list.followingAfterInteraction())
+}
+
+@MainActor @Test func scrollingAwayCancelsADeferredKeyboardFollow() {
+ let list = ViewportConversationView(frame: CGRect(x: 0, y: 0, width: 390, height: 700),
+ collectionViewLayout: ViewportConversationLayout())
+ list.layoutIfNeeded()
+ list.contentSize = CGSize(width: 390, height: 2_000)
+ list.pinToEnd()
+ list.simulatingTouch = true
+ list.updateViewport(frame: list.frame, insets: UIEdgeInsets(top: 0, left: 0, bottom: 300, right: 0), indicators: .zero)
+ let previous = list.contentOffset.y
+ list.contentOffset.y -= 100
+ list.following = list.followingAfterScroll(from: previous)
+ list.simulatingTouch = false
+ #expect(!list.followingAfterInteraction())
+}
+
+@MainActor @Test func stationaryTouchResumesViewportFollowingWithoutADragCallback() async throws {
+ let window = UIWindow(frame: CGRect(x: 0, y: 0, width: 390, height: 700))
+ let controller = UIViewController()
+ window.rootViewController = controller
+ let list = ViewportConversationView(frame: window.bounds, collectionViewLayout: ViewportConversationLayout())
+ controller.view.addSubview(list)
+ window.makeKeyAndVisible()
+ defer { window.isHidden = true; list.removeFromSuperview() }
+ list.layoutIfNeeded()
+ list.contentSize = CGSize(width: 390, height: 2_000)
+ list.pinToEnd()
+ list.simulatingTouch = true
+ list.updateViewport(frame: list.frame, insets: UIEdgeInsets(top: 0, left: 0, bottom: 300, right: 0), indicators: .zero)
+ list.simulatingTouch = false
+ try await Task.sleep(for: .milliseconds(200))
+ #expect(list.following)
+ #expect(abs(list.contentOffset.y - list.endOffset) < 1)
+}
+
+@MainActor private final class ViewportConversationView: ConversationCollectionView {
+ var simulatingTouch = false
+ override var isTracking: Bool { simulatingTouch }
+}
+
+@MainActor private final class ViewportConversationLayout: UICollectionViewLayout {
+ override var collectionViewContentSize: CGSize { CGSize(width: 390, height: 2_000) }
+ override func layoutAttributesForElements(in rect: CGRect) -> [UICollectionViewLayoutAttributes]? { [] }
+}
diff --git a/docs/features/chat-messages.md b/docs/features/chat-messages.md
index 9ac31488..32afc0e0 100644
--- a/docs/features/chat-messages.md
+++ b/docs/features/chat-messages.md
@@ -78,6 +78,14 @@ On the terminal, `t` opens Full conversation, and the working line retains the c
`ConversationList.swift`; desktop: `.row-in` in `thread.css`; reduced motion: a 0.12 s fade).
- The list stays pinned to the bottom while the reader is there; scrolling up releases it and the
round "Jump to latest" button brings it back. Sending always returns to the bottom.
+- Opening or closing the phone keyboard keeps a bottom-following chat on its latest message;
+ reading older messages preserves that position. iPhone viewport updates do not count as user
+ scrolling and wait for any active touch to finish before applying a deferred bottom follow.
+ Android already follows viewport/padding changes; desktop observes transcript resizing, and
+ the terminal renders its bottom-relative scroll position without a software keyboard.
+- iOS 26+ uses the native circular Liquid Glass button for "Jump to latest", with a material
+ fallback on older iOS. Android and Electron retain their platform controls; neither exposes
+ Apple's native Liquid Glass button API. The terminal keeps its keyboard action.
- iPhone: earlier messages load when the top of the chat comes into view, so a short chat never
shows a lasting spinner. Pulling down past the top sweeps in the `arrow.clockwise` symbol; letting
go of a full sweep (`PullToRefresh.swift`) reconnects to the computer while the chat waits just