Repository navigation
fix(ios): preserve chat live edge across keyboard transitions - #136660
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: blocked before merge. Reviewed September 2, 2026, 10:12 PM ET / September 3, 2026, 02:12 UTC. ClawSweeper reviewWhat this changesThe PR records whether an iOS chat was following its latest message before the keyboard opens, restores that position after the keyboard appears, and adds a simulator UI regression test for typing and sending. Regression provenancePossible regression — probable (reproduction; reviewed change). No predecessor PR is attributed. Merge readiness⛔ Blocked before merge - 1 item remains Keep open. This is an active Member-authored, maintainer-labeled repair; current main still lacks the keyboard live-edge restoration, and the focused owner-local change has no supported blocking correctness finding. Priority: P2 Review scores
Verification
How this fits togetherThe shared Apple chat view renders the transcript above a composer and tracks whether it should follow the newest content. Keyboard notifications alter the available viewport, so the view must preserve a live-edge decision across that system transition. flowchart LR
A[Chat at latest message] --> B[Keyboard starts showing]
B --> C[Save live-edge state]
C --> D[Keyboard shown]
D --> E[Restore bottom anchor]
F[User scroll] --> G[Cancel pending restore]
E --> H[Transcript visible above keyboard]
Before merge
Agent review detailsSecurityNone. PR surfaceOther +136. Total +136 across 2 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the pre-transition snapshot at the chat-view lifecycle owner; it cannot be absorbed into the persistent follow target without losing the distinction between a system keyboard animation and intentional reader movement. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible with high confidence: the supplied exact-head simulator scenario reports a failure on the immediately preceding test head and a pass after the owner repair, while current main still lacks that repair. Is this the best way to solve the issue? Yes. Capturing the pre-keyboard live-edge fact and restoring it in the view that owns scroll state is preferable to keeping follow enabled through all system animations, which would also override intentional reader movement. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 5db0387dff05. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
Exact-head repair and proof are now on Root cause: keyboard avoidance enters a system animated scroll phase that releases the chat reader's one-shot live-edge target. The prior keyboard handlers never restored that target after the viewport finished shrinking. The fix restores only a pre-existing live-edge position and cancels restoration for an interactive scroll or active search. Proof:
The PR remains draft, so hosted iOS and aggregate CI are still skipped; this is local exact-head simulator proof, not hosted-CI proof. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
There was a problem hiding this comment.
🟡 Changes recommended
The keyboard restore flag is currently gated in a way that can be invalidated by SwiftUI’s .animating scroll phase (which sets isUserScrolling and clears followTarget), potentially skipping the intended restore.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Fixes an iOS SwiftUI chat-reader regression where opening the keyboard can cause the transcript to appear stale/blank or slip behind the composer, by restoring the live-edge anchor after the keyboard finishes showing (while respecting intentional user scroll and active search).
Changes:
- Track whether the chat was following the live edge when the keyboard transition began, and restore the bottom anchor on
keyboardDidShow. - Cancel the pending restore when the user performs an interactive scroll during the keyboard transition.
- Extend the iPhone UI snapshot test to cover “keyboard opens → typing → send” while asserting the transcript remains visible and follows the live edge.
File summaries
| File | Description |
|---|---|
| apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatView.swift | Adds keyboard lifecycle handling to restore the live-edge follow target after keyboard presentation. |
| apps/ios/UITests/OpenClawSnapshotUITests.swift | Strengthens UI regression coverage for keyboard-visible chat rendering and post-send live-edge following. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| .onReceive(NotificationCenter.default.publisher(for: UIResponder.keyboardWillShowNotification)) { _ in | ||
| self.restoresLiveEdgeAfterKeyboardShows = | ||
| self.followTarget == .latest && !self.isUserScrolling && self.searchMessageID == nil | ||
| self.isKeyboardVisible = true |
* refs/remotes/origin/main: fix(plugins): reject unverifiable pinned npm installs (#136725) improve(ui): lift sidebar section headers on hover and mark online owners (#136985) test(cron): reuse isolated run suite hooks (#137341) test(channels): reuse shared indexed call guards (#137350) fix(ui): sidebar header controls read misaligned after the + button lost its border (#137317) fix(qa-channel): preserve conversation kind for implicit actions (#137343) fix: target the source checkout in Control UI repair commands (#137354) chore: reduce CI job count and database test overhead (#137352) fix(ios): preserve chat live edge across keyboard transitions (#136660) refactor(control-ui): consolidate mention inbox requests (#137375) fix(openai): preserve ChatGPT HTTP status for retry pacing (#137146) fix(mcp): hide policy-denied plugin tools from ACP sessions [AI] (#136546) test(queue): reuse shared deferred fixtures (#137338) fix(gateway): repair the Gateway E2E shard (browser suite project, skill resource argv, Codex diagnostic) (#137358)
…aw#136660) * test(ios): cover keyboard transcript rendering * fix(ios): preserve live edge across keyboard show --------- Co-authored-by: roboclaw-bot <[email protected]> Co-authored-by: Colin <[email protected]>
What Problem This Solves
When an iPhone chat is already following the live edge, opening the keyboard can move the latest transcript content behind the composer. The reader then appears stale or blank around typing and send transitions until another interaction changes the scroll geometry.
Refs #135214 and preserves the post-send live-edge regression boundary from #108692.
Why This Change Was Made
SwiftUI reports keyboard avoidance as a system
.animatingscroll phase. The chat reader intentionally releases its one-shot follow target for system animation, but the keyboard handlers previously only toggledisKeyboardVisible; nothing restored the live-edge anchor after the keyboard finished showing.The reader now records whether it was following latest before the keyboard transition and restores the bottom anchor after
keyboardDidShow. A real interactive scroll cancels the pending restore, and an active search result is rechecked before moving, so reading/search positions are not pulled to the bottom.The UI test also queries the long sent prompt by its
labelpredicate. XCUITest rejects direct string-subscript queries longer than 128 characters because that API performs an identifier lookup.User Impact
The latest conversation content stays visibly rendered above the keyboard while the user types and after sending. People who intentionally scroll or search during the keyboard transition keep their chosen reading position.
Evidence
Exact repaired head:
cd82ef193c2e78d00786432c532ffc9bf3afa7c0Failing baseline, exact prior head
62a393cfc2b6273e561148fa4bf4f9bf84301401:OpenClawSnapshotUITests.swift:785becauseOPENCLAW_LONG_CHAT_LATESTwas outside the visible area after the keyboard opened.Passing repaired head:
OpenClawSnapshotUITests.testKeyboardOpenPreservesTranscriptAndFollowsLiveEdgeAfterSend: passed on the same iPhone 17 / iOS 27.0 simulator.apps/shared/OpenClawKitsuite: 1,571 Swift Testing tests in 120 suites passed; 60 XCTest cases passed with two expected live speech/audio skips.Hosted iOS and aggregate CI are currently skipped because this PR remains a draft; this description does not claim hosted exact-head CI.
Source:
openclaw/apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatView.swift
Lines 502 to 519 in cd82ef1
openclaw/apps/ios/UITests/OpenClawSnapshotUITests.swift
Lines 759 to 828 in cd82ef1
Scope
Worked on by
Visual proof
Real, unedited
XCUIElementscreenshots captured from the passing exact-head test on an iPhone 17 simulator running iOS 27.0 (24A5370g). The full test simultaneously asserted that the keyboard was present and each captured transcript element intersected the visible area above it.Latest seeded transcript content remains rendered while typing:
Reply remains rendered after send: