iOS: pin the keyboard dock to the system keyboard on every frame
Rapidly toggling the iOS keyboard could leave the bottom dock (composer band plus toolbar) detached from the keyboard: it popped after the surface frame settled, floated over stale geometry after remount, or lagged the keyboard animation by several frames.
Mechanism: the dock is now a real system keyboard accessory (inputAccessoryView), so UIKit owns its attachment to the key plane instead of cmux chasing keyboard notifications. The keyboard floor anchors to the window rather than the terminal surface, the surface frame is pinned across keyboard transitions, the toggle button decides from responder truth instead of a tracked bit, and keyboard visibility (and the toggle glyph) reconcile on remount.
Dogfooding the accessory architecture surfaced three follow-on defects, all fixed here:
- Focusing the composer field never raised the keyboard (and could collapse a raised one). A SwiftUI
TextFieldhosted inside the keyboard accessory takes first responder but UIKit never begins a keyboard presentation. The field is now a UIKitUITextView(MobileComposerTextField), the Messages pattern, and the band container answers UIKit's responder-chain walk with the shared dock instance so the accessory survives the focus handoff. - Closing the photo library left the dock unmounted forever. Presenting used to resign the text owner, which unmounts the accessory-hosted composer band, so the picker's dismissal binding could never deliver and the modal phase wedged. The input-session reducer now keeps the owner seated through a system modal and restores a presentation-stripped responder at dismissal; the surface re-seats its keyboard-down first-responder anchor around the picker lifecycle.
- The CI stress lane could not see a software keyboard at all. Two causes: the field-focus defect above, plus freshly erased simulators rendering the one-time QuickPath (slide-to-type) introduction where the first key plane would appear. CI now seeds
DidShowContinuousPathIntroductioninside the booted device viasimctl spawn, replacing an osascript Cmd-K watcher that repo policy bans and that never actually executed in any run.
Verification harness: an opt-in KeyboardDockFrameRecorder rides the terminal's existing display link and measures the gap between the visible dock edge and the system accessory bottom on every frame. testTerminalKeyboardDockRapidToggleIsPixelAttachedEveryFrame drives 12 full software-keyboard up/down cycles through the production composer and fails if any frame exceeds a one-point budget, plus unit tests for the frame tracker, transition model, recorder, reducer modal contract, and dock responder wiring. test-ios.yml also gains Class/testMethod filter shorthand expansion (so a dispatch cannot silently execute zero tests) and failure-time simulator screenshots plus xcresult upload as a diagnostics artifact.
scripts/iphone-install-queue.sh also stops multi-tag drains from fighting over the phone's foreground: only the newest queued build gets the signed launch, older ones install unlaunched.
Note: the iOS lanes are currently red on main too (mobile-core-package, package-conventions-lint fail at 6089fa04); this branch's evidence is the filtered stress-lane dispatch.
Dictionary:
- stress lane: the workflow_dispatch run of test-ios.yml filtered to the rapid-toggle test.
- filter shorthand expansion: rewriting
cmuxUITests/testXto the target-qualifiedcmuxUITests/cmuxUITests/testXxcodebuild requires. - headless boot: booting a CoreSimulator device without the Simulator.app host attached.
- display link: the per-frame vsync callback the recorder samples on.
- diagnostics artifact: the failure-time screenshot, keyboard prefs dump, and xcresult the job uploads.
š¤ Generated with Claude Code
[!NOTE]
High Risk
Large refactor of keyboard/dock layout, first-responder, and modal input-session behavior across the terminal surface and composer; regressions would show as wedged keyboards, missing dock, or broken attach flows.
Overview
Rapid keyboard toggles used to detach the composer/toolbar dock from the software keyboard because cmux chased keyboardLayoutGuide and notification-driven layout on the terminal surface. The bottom chrome is now a shared KeyboardDockAccessoryView returned as inputAccessoryView from the surface, input proxy, and composer container so UIKit owns dock position; grid reservation still follows a process-wide MobileKeyboardFrameTracker, and the terminal surface frame is pinned with ignoresSafeArea(.container, edges: .bottom) so mid-transition conversions stay stable.
Composer focus and attachments: the message field switches from SwiftUI TextField to UIKit MobileComposerTextField inside the accessory, and Photos picking moves to an app-window anchor via ComposerPhotoPickerBridge so presentation/dismissal does not wedge the dock. The input-session reducer keeps the text owner seated through system modals and restores focus after dismissal; the surface re-seats first responder around picker lifecycle.
Verification and tooling: DEBUG KeyboardDockFrameRecorder plus testTerminalKeyboardDockRapidToggleIsPixelAttachedEveryFrame (12 up/down cycles, ā¤1pt gap); CI seeds simulator keyboard prefs, expands Class/testMethod filters for xcodebuild, uploads failure diagnostics, and iphone-install-queue.sh launches only the newest queued build on multi-tag drains. MobileInjectedAttachStartupTests is rewritten to the shipped coordinator API so the test plan compiles.
Reviewed by Cursor Bugbot for commit 1db0dce435a35c77402cb0a1090009ec47b6f03c. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit
- New Features
- Improved keyboard dock positioning, resizing, alignment, and transition handling.
- Added a growing composer field with enhanced focus handling, accessibility, and line limits.
- Improved photo picker presentation and attachment staging.
- Bug Fixes
- Preserved composer focus while opening and dismissing photo pickers or system modals.
- Maintained terminal layout and dock clearance during keyboard transitions.
- Improved reconnect behavior for interrupted mobile attachments.
- Tests
- Added coverage for keyboard alignment, focus restoration, photo-picker flows, and repeated keyboard interactions.