Skip to content

fix(swift-ios): keep composer above software keyboard - #6145

Draft
saphid wants to merge 2 commits into
pingdotgg:t3code/rebuild-mobile-app-swiftfrom
saphid:agent/swiftui-keyboard-clearance-extracted
Draft

fix(swift-ios): keep composer above software keyboard#6145
saphid wants to merge 2 commits into
pingdotgg:t3code/rebuild-mobile-app-swiftfrom
saphid:agent/swiftui-keyboard-clearance-extracted

Conversation

@saphid

@saphid saphid commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

What

Keeps the composer input and footer controls clear of a docked software keyboard, including New Task autofocus and accessibility text sizes.

Scope

Two focused commits: the keyboard geometry/notification foundation and the New Task follow-up. Only FeatureComposerView and FeatureComposerPowerTests change.

Verification

  • FeatureComposerPowerTests: 12 tests passed
  • Exact extracted head compiled in the focused native test run
  • Existing visual proof from the same extracted behavior: keyboard-autogrowth.mp4

Dependencies and gate

Note

Keep the chat composer above the software keyboard on iOS

  • Adds FeatureComposerKeyboardLayout enum in FeatureComposerView.swift to centralize keyboard detection logic: determines when a local, docked, sufficiently tall keyboard occupies the screen and adjusts the composer's line limit and bottom clearance accordingly.
  • When a docked keyboard is visible, the TextField line limit collapses to a single line and the footer padding reduces to avoid content being clipped.
  • Adds FeatureComposerWindowReader (UIViewRepresentable) to expose the composer's UIWindow so keyboard frames can be converted to view coordinates and the keyboard layout guide can be read.
  • Subscribes to keyboard show/hide/frame-change notifications to keep dockedSoftwareKeyboardOccupiesScreen state current.
  • Adds unit tests in FeatureComposerPowerTests.swift covering docked/floating/hidden keyboard states and accessibility-size clearance.
📊 Macroscope summarized 54cf050. 1 file reviewed, 0 issues evaluated, 0 issues filtered, 0 comments posted

🗂️ Filtered Issues

No issues evaluated.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 47d8b43a-68f6-4786-850c-4ecdea266034

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@github-actions github-actions Bot added size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. labels Aug 11, 2026
@State private var isManuallyExpanded = false
@State private var isAttachmentFlowActive = false
@State private var dockedSoftwareKeyboardOccupiesScreen = false
@State private var composerWindow: UIWindow?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium Chat/FeatureComposerView.swift:9

composerWindow is stored as a strong @State reference to UIWindow. The window retains its root view controller and view hierarchy, which includes this composer and its SwiftUI state, so dismissing the hierarchy can leave the entire window/composer graph retained — a memory leak. Consider wrapping the window in a weak reference holder rather than storing it directly in @State.

Suggested change
@State private var composerWindow: UIWindow?
+@State private var composerWindow: FeatureComposerWindowBox?
🤖 Copy this AI Prompt to have your agent fix this:
In file @apps/swift-ios/Features/Chat/FeatureComposerView.swift around line 9:

`composerWindow` is stored as a strong `@State` reference to `UIWindow`. The window retains its root view controller and view hierarchy, which includes this composer and its SwiftUI state, so dismissing the hierarchy can leave the entire window/composer graph retained — a memory leak. Consider wrapping the window in a weak reference holder rather than storing it directly in `@State`.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant