Uh oh!
There was an error while loading. Please reload this page.
Fix iOS 17 Metal errors when TextInput caret is hidden - #58158
Open
levibuzolic wants to merge 1 commit into
Open
Fix iOS 17 Metal errors when TextInput caret is hidden#58158levibuzolic wants to merge 1 commit into
levibuzolic wants to merge 1 commit into
Conversation
levibuzolic
marked this pull request as ready for review
August 27, 2026 06:51
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary:
Fixes#58157.
On iOS 17.2,
caretHiddenmakes a single-lineTextInputreturnCGRectZerofromcaretRectForPosition:. When the caret moves, Core Animation repeatedly logsSurface 1073741823 x 1073741823 is too large. This activity can prevent XCUITest from detecting an idle app.This change keeps the caret geometry intact and hides a collapsed caret with a transparent tint. It restores the requested
selectionColorfor non-empty selections so the highlight and handles remain visible. Fabric also reappliesselectionColorafter switching between single-line and multiline backing views.Changelog:
[IOS] [FIXED] - Prevent hidden TextInput carets from causing repeated Metal surface errors.
Test Plan:
Ran clang-format on all changed Objective-C files:
Result: passed.
Built the from-source HelloWorld app:
xcodebuild -workspace private/helloworld/ios/HelloWorld.xcworkspace -scheme HelloWorld -configuration Debug -sdk iphonesimulator -destination 'generic/platform=iOS Simulator' CODE_SIGNING_ALLOWED=NO buildResult:
BUILD SUCCEEDED.Syntax-checked the new Objective-C++ test file:
Result: passed.
Tested
private/helloworldon an iPhone SE 3 simulator with iOS 17.2:caretHidden={false}kept its visible red caret.Tested the same states on iOS 18.0. Both the hidden caret and selection highlight behaved correctly, with no matching errors.
Tested a native Mac Catalyst harness on macOS 26. A transparent tint hid the caret.
Caret-hiding experiments
These results came from iOS 17.2 during 10 seconds of caret movement:
CGRectZeroCGRectNull0.01ptwidthtintColorReferences
Apple documentation:
caretRect(for:)UIView.tintColorUIView.TintAdjustmentMode.dimmed— returns a desaturated tint colour; measurements showed alpha is scaled rather than reset, so a transparent tint stays transparent.UITextSelectionDisplayInteraction— the iOS 17 API behind the rejected alternative.Repository history:
e13b9c6e49(2017-05-29) — theCGRectZerooverride already existed at this point, so the implementation predates iOS 17 by several years. It was correct when written; iOS 17 changed caret rendering underneath it.scrollRangeToVisible:no-op referenced inRCTUITextField.mm.Apple's documentation does not mention the oversized-surface behaviour, and no public report of the
Surface 1073741823 x 1073741823 is too largemessage could be found. The version range in this document comes from local measurement.