Skip to content

iOS: fix comment composer auto-closing when keyboard opens#2

Draft
kubo6472 wants to merge 1 commit into
mainfrom
cursor/fix-ios-comment-composer-auto-close-0b57
Draft

iOS: fix comment composer auto-closing when keyboard opens#2
kubo6472 wants to merge 1 commit into
mainfrom
cursor/fix-ios-comment-composer-auto-close-0b57

Conversation

@kubo6472

Copy link
Copy Markdown
Member

Problem

On iOS, tapping the comment composer (or Reply) would briefly show the keyboard, then immediately dismiss it — making it impossible to type a comment.

Root cause

The floating comment input was only shown when GeometryReader reported portrait (width <= height). When the keyboard opens, the available view height shrinks enough that width exceeds height, so SwiftUI treated the layout as landscape, removed the TextField from the hierarchy, and focus was lost.

Fix

  • Track device orientation (UIDevice.orientationDidChangeNotification) for landscape UI gating instead of geometry size
  • Add .scrollDismissesKeyboard(.never) on the comments ScrollView so incidental scrolling doesn't dismiss the keyboard

Testing

Manual verification on iOS device/simulator:

  1. Open a video post with comments
  2. Tap the bottom comment field — keyboard should stay open
  3. Tap Reply on a comment — keyboard should stay open with reply banner
  4. Rotate to landscape — composer should still hide and fullscreen player should still engage
Open in Web Open in Cursor 

The comment input overlay was gated on GeometryReader width > height to
detect landscape. When the keyboard appears, the available height shrinks
enough that width exceeds height, so SwiftUI removed the TextField from the
view hierarchy and focus (keyboard) was lost immediately.

Track device orientation instead for landscape UI gating, and prevent the
comments ScrollView from dismissing the keyboard on scroll.

Co-authored-by: Jakub Doboš <kubo6472@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f14e8e91-5931-4154-ba4d-8c74d753306f

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
✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch cursor/fix-ios-comment-composer-auto-close-0b57

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.

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.

2 participants