You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
iOS - Keyboard closes after pasting text into the composer #86578
Version Number: 9.3.50-2 Reproducible in staging?: Yes Reproducible in production?: No If this was caught during regression testing, add the test name, ID and link from BrowserStack:https://test-management.browserstack.com/projects/2219752/folder/13176681/test-cases/41236971 Email or phone of affected tester (no customers):fischer9966+053122@gmail.com Issue reported by: Applause Internal Team Bug source: Regression TC Execution Device used: iPhone 17 Pro / 26.3.1. iPad 9th gen / 26.3.1 App Component: Chat Report View
Action Performed:
Login with any account to Expensify app on iPhone or iPad
Go to any chat
Tap to composer field to open keyboard
Copy any text and paste it into composer
Expected Result:
Keyboard remain open after pasting text into the composer field
Actual Result:
Keyboard closes after pasting text into the composer field
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
Identify the pull request that introduced this issue and revert it.
Classification: Frontend bug Causing PR: #84423 - "Multi file upload support (v2)" by @chrispader (High confidence) Related Issues: None
Recommendation: REVERT
PR #84423 modified the React Native patch for onPaste to support multiple files. The iOS implementation has a bug where pasting plain text calls [super paste:sender] to keep the keyboard open, but pasting text that contains any rich formatting (HTML, RTF, etc.) skips the [super paste:sender] call, causing iOS to dismiss the keyboard.
When you copy text on iOS and paste it, the clipboard often contains BOTH plain text AND rich text/HTML representations. The paste handler checks for file URL representations and takes the "slow path" for any non-plain-text clipboard items, which results in the keyboard being dismissed.
PR updates the React Native patch react-native+0.83.1+011+Add-onPaste-to-TextInput.patch
PR also modifies src/components/Composer/implementation/index.native.tsx
Verification
The React Native patch in PR #84423 modifies /node_modules/react-native/Libraries/Text/TextInput/Multiline/RCTUITextView.mm:
// Fast path for plain text - also call super to insert the textif (clipboard.hasStrings && clipboard.string != nil &&
![RCTPasteHandlerUtil containsFileURLRepresentation:clipboard]) {
NSDictionary<NSString *, NSString *> *stringItem = @{@"type": @"text/plain", @"data": clipboard.string};
[_textInputDelegateAdapter didPaste:@[stringItem]];
[superpaste:sender]; // ← Keyboard stays openreturn;
}
// Process non-text items using the utilityNSArray<NSDictionary<NSString *, NSString *> *> *items =
[RCTPasteHandlerUtil itemInfosFromPasteboard:clipboard];
if (items.count == 0) {
[superpaste:sender];
return;
}
[_textInputDelegateAdapter didPaste:items]; // ← Missing [super paste:sender] causes keyboard to close
Root Cause
When pasting text that contains rich formatting (which is common when copying from any app), iOS takes the second code path that processes "non-text items". This path calls [_textInputDelegateAdapter didPaste:items] but does NOT call [super paste:sender], which causes iOS to dismiss the keyboard because the system thinks the paste operation is complete without actually modifying the text input.
The fix needs to either:
Always call [super paste:sender] when pasting text (even if rich formatted)
Or prevent the keyboard from dismissing after the paste handler completes
PR #84423 (Multi file upload support v2) modified the React Native onPaste iOS native patch to fire the didPaste: callback for all paste events, including plain text. Previously, pasting plain text only called [super paste:sender] to insert the text and did not fire the JS onPaste event.
Now when plain text is pasted on iOS:
The native patch fires didPaste: with a text/plain item → triggers the JS onPaste event
The Composer's pasteFile handler in index.native.tsx:91-126 filters out text/plain items but still calls onPasteFile([]) with an empty array
In ComposerWithSuggestions.tsx:965-968, the onPasteFile wrapper unconditionally calls textInputRef.current?.blur(), which dismisses the keyboard — even when the files array is empty
What changes do you think we should make in order to solve the problem?
In src/components/Composer/implementation/index.native.tsx, skip calling onPasteFile when the resulting files array is empty. This restores the pre-PR-#84423 behavior where plain text pastes never reach onPasteFile:
// In the pasteFile callback, after Promise.allSettled:
if (files.length > 0) {
onPasteFile(files);
}
This is the most minimal and correct fix — it keeps the native patch sending all paste events (which may be useful for future features) while preventing the empty-array path from triggering the blur.
What alternative solutions did you explore?
Guard the blur() in ComposerWithSuggestions.tsx: Only call blur() when files.length > 0. This would also work but is a less clean fix since it's better to not propagate an empty event at all.
Modify the native iOS patch to not fire didPaste: for text-only pastes. This would work but removes a potentially useful signal (knowing when text was pasted) and the native patch already handles this correctly — the issue is in the JS layer.
Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot <your feedback> to refine this analysis, or explain why you are rejecting Melvin's proposal.
Activity
melvin-bot commentedon Mar 27, 2026
Triggered auto assignment to @dangrous (
DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.github-actions commentedon Mar 27, 2026
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
melvin-bot commentedon Mar 27, 2026
💬 A slack conversation has been started in #expensify-open-source
OSBotify commentedon Mar 27, 2026
Investigation Summary
Classification: Frontend bug
Causing PR: #84423 - "Multi file upload support (v2)" by @chrispader (High confidence)
Related Issues: None
Recommendation: REVERT
PR #84423 modified the React Native patch for
onPasteto support multiple files. The iOS implementation has a bug where pasting plain text calls[super paste:sender]to keep the keyboard open, but pasting text that contains any rich formatting (HTML, RTF, etc.) skips the[super paste:sender]call, causing iOS to dismiss the keyboard.When you copy text on iOS and paste it, the clipboard often contains BOTH plain text AND rich text/HTML representations. The paste handler checks for file URL representations and takes the "slow path" for any non-plain-text clipboard items, which results in the keyboard being dismissed.
Labels: Keeping
DeployBlockerCash(frontend bug blocking App deploy). No label changes needed.Detailed Analysis
Evidence
react-native+0.83.1+011+Add-onPaste-to-TextInput.patchsrc/components/Composer/implementation/index.native.tsxVerification
The React Native patch in PR #84423 modifies
/node_modules/react-native/Libraries/Text/TextInput/Multiline/RCTUITextView.mm:Root Cause
When pasting text that contains rich formatting (which is common when copying from any app), iOS takes the second code path that processes "non-text items". This path calls
[_textInputDelegateAdapter didPaste:items]but does NOT call[super paste:sender], which causes iOS to dismiss the keyboard because the system thinks the paste operation is complete without actually modifying the text input.The fix needs to either:
[super paste:sender]when pasting text (even if rich formatted)MelvinBot commentedon Mar 27, 2026
Proposal
What is the root cause of that problem?
PR #84423 (Multi file upload support v2) modified the React Native
onPasteiOS native patch to fire thedidPaste:callback for all paste events, including plain text. Previously, pasting plain text only called[super paste:sender]to insert the text and did not fire the JSonPasteevent.Now when plain text is pasted on iOS:
didPaste:with atext/plainitem → triggers the JSonPasteeventpasteFilehandler inindex.native.tsx:91-126filters outtext/plainitems but still callsonPasteFile([])with an empty arrayComposerWithSuggestions.tsx:965-968, theonPasteFilewrapper unconditionally callstextInputRef.current?.blur(), which dismisses the keyboard — even when the files array is emptyWhat changes do you think we should make in order to solve the problem?
In
src/components/Composer/implementation/index.native.tsx, skip callingonPasteFilewhen the resultingfilesarray is empty. This restores the pre-PR-#84423 behavior where plain text pastes never reachonPasteFile:This is the most minimal and correct fix — it keeps the native patch sending all paste events (which may be useful for future features) while preventing the empty-array path from triggering the blur.
What alternative solutions did you explore?
Guard the
blur()inComposerWithSuggestions.tsx: Only callblur()whenfiles.length > 0. This would also work but is a less clean fix since it's better to not propagate an empty event at all.Modify the native iOS patch to not fire
didPaste:for text-only pastes. This would work but removes a potentially useful signal (knowing when text was pasted) and the native patch already handles this correctly — the issue is in the JS layer.Next Steps for Contributor+ team: Reply with
@MelvinBot implement thisto create a draft PR,@MelvinBot <your feedback>to refine this analysis, or explain why you are rejecting Melvin's proposal.parasharrajat commentedon Mar 28, 2026
@chrispader cc
chrispader commentedon Mar 30, 2026
Looking into this straight away.
melvin-bot commentedon Mar 30, 2026
If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.
If a regression has occurred and you are the assigned CM follow the instructions here.
If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.
dangrous commentedon Mar 30, 2026
PR is being reverted, I believe - #86652
chrispader commentedon Mar 30, 2026
I'm working on a PR which fixes this here:
jasperhuangg commentedon Mar 31, 2026
@dangrous requested retest here
m-natarajan commentedon Mar 31, 2026
Not repro, iPhone13/26.3.1, v9.3.50-4 PR:86652 Ad-Hoc
ScreenRecording_03-30-2026.22-23-00_1.MP4
m-natarajan commentedon Mar 31, 2026
Not reproducible on iPhone 13/iOS 26.3 v9.3.50-7 PR:86730 Ad-Hoc
ScreenRecording_03-31-2026.16-43-12_1.MP4
dangrous commentedon Mar 31, 2026
Nice, I think we can close this.