Skip to content

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

Open
kubo6472 wants to merge 2 commits into
coulterpeterson:mainfrom
tojemoc:cursor/fix-ios-comment-composer-auto-close-0b57
Open

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

Conversation

@kubo6472

@kubo6472 kubo6472 commented Jun 25, 2026

Copy link
Copy Markdown

Closes #46

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 

kubo6472 and others added 2 commits June 25, 2026 14:51
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š <[email protected]>
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.

iOS: can't reply to a comment

2 participants