Fix text field positioning in modal/popup presentations #2134
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
This PR fixes an issue where text fields in popup UI (modal/popover presentations) would incorrectly move to the top of the screen when the keyboard appeared, instead of maintaining proper positioning relative to their container.
Problem
The issue occurred because the coordinate conversion logic assumed
rootController.view.superviewwould always be a valid coordinate space. However, in modal presentations, this property is oftennil, causing coordinate conversions to return incorrect values (typically{0,0,0,0}). This resulted in wildly incorrect position calculations that made text fields appear to "jump" to the screen top.Root Cause
The problematic code was present in multiple locations:
Swift version:
Objective-C version:
Solution
Implemented smart fallback logic that uses window coordinates as an intermediate step when
rootController.view.superviewisnil:This approach maintains proper positioning for modal presentations while preserving existing behavior for regular presentations.
Changes Made
IQKeyboardManagerSwift/IQKeyboardManager/IQKeyboardManager+Position.swiftIQKeyboardManager/IQKeyboardManager.mFixed coordinate conversion in all affected locations:
Verification
The fix ensures text fields in popup scenarios maintain proper positioning when the keyboard appears, resolving the issue where they would incorrectly jump to the screen top.
Fixes #2101.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.