Skip to content

Reapply "Fix iOS 27 keyboard toggle focus handoff" - #10152

Merged
azooz2003-bit merged 1 commit into
mainfrom
revert-10151-revert-10006-fix-ios27-keyboard-toggle-animation
Aug 14, 2026
Merged

azooz2003-bit merged 1 commit into
mainfrom
revert-10151-revert-10006-fix-ios27-keyboard-toggle-animation

Conversation

@azooz2003-bit

@azooz2003-bit azooz2003-bit commented Aug 14, 2026 •

Copy link
Copy Markdown
Collaborator

Reapply the verified iOS 27 keyboard-toggle fix after the accidental revert.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.


Summary by cubic

Reapplies the iOS 27 keyboard-toggle fix by moving keyboard motion to a host view and freezing renderer geometry during transitions. Previously, UIKeyboardLayoutGuide could be stale on iOS 27, causing one-frame gaps and snap-on-reopen; pending scrolls could reveal a stale viewport. Now the host animates the dock and terminal together, then folds the settled edge into the renderer; pending scrolls drain before verified replay reveal.

  • Keyboard and presentation:
    • Introduces GhosttySurfaceHostView to own dock and terminal presentation; only iOS 27 uses notification-derived geometry, other OS versions keep the system guide.
    • GhosttySurfaceView defers geometry while keyboardPresentationTransitionActive and exposes hosted APIs to finish the transition at the exact edge.
    • MobileKeyboardTransition adds beginFrame/beginOverlap to detect reversals; host rebases from live frames to avoid clip/dock gaps.
  • Input focus and replay:
    • Adds .requestVisibleFocus to TerminalInputSessionReducer; terminal/composer focus requests now show the keyboard without reloading input views mid-transition.
    • Adds drainPendingScrollForVerifiedReplayReveal() and generation-tracked local scroll application to prevent stale viewport flashes.
  • Tests and CI:
    • Adds UI tests that assert the rendered terminal edge stays pinned to the dock through rapid reversals and in-place control taps; unit tests cover scroll-drain behavior.
    • Sets ONLY_ACTIVE_ARCH=YES for the iOS Simulator build.
    • No behavior change on iOS ≤ 26; the host path applies only to iOS 27.

Written for commit db9a37c. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • Bug Fixes
    • Improved keyboard and bottom-dock transitions for smoother terminal resizing and more accurate presentation alignment.
    • Fixed viewport restoration during replay reveals when pending scrolling is still settling.
    • Improved focus recovery when the terminal already owns focus.
    • Prevented stale scroll operations from overriding newer interactions.
  • Testing
    • Added coverage for keyboard reversals, terminal-to-dock alignment, replay scrolling, and focus restoration.
  • Build Improvements
    • Updated iOS Simulator builds for arm64 architecture.

@coderabbitai

coderabbitai Bot commented Aug 14, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 11a8ddd3-1766-4ed6-81ea-0b6410a5034b

📥 Commits

Reviewing files that changed from the base of the PR and between c1458ba and db9a37c.

📒 Files selected for processing (13)
  • .github/workflows/reload-build.yml
  • Packages/iOS/CmuxMobileShellUI/Sources/CmuxMobileShellUI/GhosttySurfaceRepresentable.swift
  • Packages/iOS/CmuxMobileShellUI/Sources/CmuxMobileShellUI/MobileSettingsView.swift
  • Packages/iOS/CmuxMobileSupport/Sources/CmuxMobileSupport/MobileKeyboardTransition.swift
  • Packages/iOS/CmuxMobileTerminal/Sources/CmuxMobileTerminal/GhosttySurfaceHostView.swift
  • Packages/iOS/CmuxMobileTerminal/Sources/CmuxMobileTerminal/GhosttySurfaceView+LocalScrollbackScroll.swift
  • Packages/iOS/CmuxMobileTerminal/Sources/CmuxMobileTerminal/GhosttySurfaceView.swift
  • Packages/iOS/CmuxMobileTerminal/Sources/CmuxMobileTerminal/TerminalViewportCoordinator.swift
  • Packages/iOS/CmuxMobileTerminal/Sources/CmuxMobileTerminal/TerminalViewportInputs.swift
  • Packages/iOS/CmuxMobileTerminal/Tests/CmuxMobileTerminalTests/VerifiedReplayPresentationTests.swift
  • Packages/iOS/CmuxMobileTerminalKit/Sources/CmuxMobileTerminalKit/TerminalInputSessionReducer.swift
  • Packages/iOS/CmuxMobileTerminalKit/Tests/CmuxMobileTerminalKitTests/TerminalInputSessionReducerTests.swift
  • ios/cmuxUITests/cmuxUITests.swift

📝 Walkthrough

Walkthrough

The PR moves keyboard presentation coordination into GhosttySurfaceHostView, synchronizes terminal geometry and viewport negotiation, adds generation-aware scroll replay draining, reasserts visible focus, and expands keyboard reversal tests. It also updates the simulator build architecture and settings binding.

Changes

iOS terminal presentation

Layer / File(s) Summary
Keyboard transition host
Packages/iOS/CmuxMobileSupport/Sources/CmuxMobileSupport/MobileKeyboardTransition.swift, Packages/iOS/CmuxMobileTerminal/Sources/CmuxMobileTerminal/GhosttySurfaceHostView.swift
Keyboard transitions retain begin and end frames. The host coordinates dock constraints, presentation transforms, transition completion, and diagnostics.
Surface geometry and viewport synchronization
Packages/iOS/CmuxMobileTerminal/Sources/CmuxMobileTerminal/GhosttySurfaceView.swift, Packages/iOS/CmuxMobileTerminal/Sources/CmuxMobileTerminal/TerminalViewport*.swift
Surface geometry, auto-fit, dock constraints, and viewport negotiation defer work during hosted keyboard transitions.
Scroll generation and replay reveal
Packages/iOS/CmuxMobileTerminal/Sources/CmuxMobileTerminal/GhosttySurfaceView*.swift, Packages/iOS/CmuxMobileShellUI/Sources/CmuxMobileShellUI/GhosttySurfaceRepresentable.swift, Packages/iOS/CmuxMobileTerminal/Tests/CmuxMobileTerminalTests/VerifiedReplayPresentationTests.swift
Local scroll work tracks interaction generations and supports async draining before verified replay reveal.
Visible focus reassertion
Packages/iOS/CmuxMobileTerminalKit/Sources/CmuxMobileTerminalKit/TerminalInputSessionReducer.swift, Packages/iOS/CmuxMobileTerminal/Sources/CmuxMobileTerminal/GhosttySurfaceView.swift, Packages/iOS/CmuxMobileTerminalKit/Tests/CmuxMobileTerminalKitTests/TerminalInputSessionReducerTests.swift
Visible focus requests emit focus commands even when the requested owner already owns focus.
Presentation validation and build wiring
ios/cmuxUITests/cmuxUITests.swift, .github/workflows/reload-build.yml, Packages/iOS/CmuxMobileShellUI/Sources/CmuxMobileShellUI/MobileSettingsView.swift
UI tests check terminal-to-dock pinning during keyboard reversals. Simulator builds restrict compilation to the active architecture. Settings creates a bindable toast reference.

Estimated code review effort: 5 (Critical) | ~120 minutes

Possibly related PRs

Suggested reviewers: lawrencecchen

Sequence Diagram(s)

sequenceDiagram
  participant Keyboard
  participant GhosttySurfaceHostView
  participant GhosttySurfaceView
  participant TerminalRenderer
  Keyboard->>GhosttySurfaceHostView: Send keyboard frame transition
  GhosttySurfaceHostView->>GhosttySurfaceHostView: Calculate dock reservation and terminal transform
  GhosttySurfaceHostView->>GhosttySurfaceView: Publish transition state and settled geometry
  GhosttySurfaceView->>TerminalRenderer: Apply final renderer geometry
Loading
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch revert-10151-revert-10006-fix-ios27-keyboard-toggle-animation

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@azooz2003-bit
azooz2003-bit merged commit 4f0f2c7 into main Aug 14, 2026
5 of 6 checks passed
@azooz2003-bit
azooz2003-bit deleted the revert-10151-revert-10006-fix-ios27-keyboard-toggle-animation branch August 14, 2026 05:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant