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
[$250] Chat - Mentions copied from mweb are shown in clipboard but not pasted in android app #75991
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.ExternalAdded to denote the issue can be worked on by a contributorWeeklyKSv2
@dreamnitethedragon+ebsjsjjsis@gmail.com~
4. Send the message
5. Copy the message from context menu
6. Launch app
7. Open a chat
8. Paste the message
9. Send the message
Expected Result:
Mentions copied from mweb are shown in clipboard so must be pasted in android app.
Actual Result:
Mentions copied from mweb are shown in clipboard but not pasted in android app.
changed the title [-]Chat - Mentions copied from mweb are shown in clipboard but not pasted in android app[/-][+][$250] Chat - Mentions copied from mweb are shown in clipboard but not pasted in android app[/+]on Nov 28, 2025
Please re-state the problem that we are trying to solve in this issue.
When copying a message containing mentions from mobile web (mWeb) and pasting it into the Android app, the mentions are stripped and not pasted correctly.
What is the root cause of that problem?
Root Cause Flow:
Copy (mWeb):Clipboard.setHtml() writes both text/html (with <mention-user> tags) and text/plain (markdown with @username) to clipboard
* Sets a string on the Clipboard object via react-native-web
*/
constsetString: SetString=(text)=>{
Clipboard.setString(text);
};
exportdefault{
Paste (Android): React Native's ReactEditText.onTextContextMenuItem() receives the paste action and delegates to super.onTextContextMenuItem(pasteAsPlainText)
+ override fun onTextContextMenuItem(id: Int): Boolean {
This patch modifies TextInput to support handling pasted images: #41239
When pasting text copied from mWeb, the id received is android.R.id.paste.
Our patch treats this as android.R.id.pasteAsPlainText and triggers custom paste logic.
However, because the pasted content is plain text, it does not satisfy certain conditions in the custom logic, and we fall through to:
What alternative solutions did you explore? (Optional)
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion: N/A
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.ExternalAdded to denote the issue can be worked on by a contributorWeeklyKSv2
Activity
melvin-bot commentedon Nov 25, 2025
Triggered auto assignment to @greg-schroeder (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.melvin-bot commentedon Nov 28, 2025
Job added to Upwork: https://www.upwork.com/jobs/~021994481236967436315
[-]Chat - Mentions copied from mweb are shown in clipboard but not pasted in android app[/-][+][$250] Chat - Mentions copied from mweb are shown in clipboard but not pasted in android app[/+]melvin-bot commentedon Nov 28, 2025
Triggered auto assignment to Contributor-plus team member for initial proposal review - @situchan (
External)TaduJR commentedon Nov 29, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
When copying a message containing mentions from mobile web (mWeb) and pasting it into the Android app, the mentions are stripped and not pasted correctly.
What is the root cause of that problem?
Root Cause Flow:
Copy (mWeb):
Clipboard.setHtml()writes bothtext/html(with<mention-user>tags) andtext/plain(markdown with@username) to clipboardApp/src/libs/Clipboard/index.ts
Lines 103 to 140 in f82a8db
Paste (Android): React Native's
ReactEditText.onTextContextMenuItem()receives the paste action and delegates tosuper.onTextContextMenuItem(pasteAsPlainText)https://github.com/facebook/react-native/blob/49820611f5369ddbe7c758152d19ed899d296cbd/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.kt#L368-L371
Android's TextView parses the HTML content and strips unknown tags like
<mention-user>because it doesn't recognize themResult: Text arrives in the composer without mentions
Logs:
item.text:"*Jhehd\n@manager_mctest@expensify.com\n..."(correct)item.htmlText:"<mention-user accountid=\"18964612\">..."(correct)"Jhehd\n\n\nHd\n~..."(mentions stripped)What changes do you think we should make in order to solve the problem?
Modify React Native's
ReactEditText.onTextContextMenuItem()to manually insertitem.textinstead of delegating to Android's HTML parsing.Location to modify:
https://github.com/facebook/react-native/blob/49820611f5369ddbe7c758152d19ed899d296cbd/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.kt#L368-L371
Replace with:
Implementation approach:
patch-packagefor immediate resolutionWhat alternative solutions did you explore? (Optional)
<mention-user>- Requires changes across all platformsuseHtmlPastehook for Android - More complex, requires native clipboard reading modulemelvin-bot commentedon Dec 4, 2025
@situchan Huh... This is 4 days overdue. Who can take care of this?
linhvovan29546 commentedon Dec 5, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
Mentions copied from mweb are shown in clipboard but not pasted in android app.
What is the root cause of that problem?
This issue occurs on Android due to the custom patch applied in our app:
App/patches/react-native/react-native+0.81.4+011+Add-onPaste-to-TextInput.patch
Line 460 in 57c0cbc
This patch modifies TextInput to support handling pasted images: #41239
When pasting text copied from mWeb, the id received is
android.R.id.paste.Our patch treats this as
android.R.id.pasteAsPlainTextand triggers custom paste logic.However, because the pasted content is plain text, it does not satisfy certain conditions in the custom logic, and we fall through to:
App/patches/react-native/react-native+0.81.4+011+Add-onPaste-to-TextInput.patch
Line 497 in 57c0cbc
App/patches/react-native/react-native+0.81.4+011+Add-onPaste-to-TextInput.patch
Line 502 in 57c0cbc
The problem arises because we pass the original
idback to the system. This leads the system to process the wrong id, causing the paste bugWhat changes do you think we should make in order to solve the problem?
We should update the patch so that we return
modifiedIdinstead ofidApp/patches/react-native/react-native+0.81.4+011+Add-onPaste-to-TextInput.patch
Line 502 in 57c0cbc
return super.onTextContextMenuItem(modifiedId)The reason we should use
modifiedIdis that same as the original code from before the patch was appliedhttps://github.com/facebook/react-native/blob/95cc1e76756ea0d67bfe20be35aff99c4028f2f2/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.kt#L370-L373
What alternative solutions did you explore? (Optional)
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
11 remaining items
linhvovan29546 commentedon Dec 17, 2025
@greg-schroeder The PR was deployed to production on Dec 11, 2025, the automation bot failed. #76930 (comment)
linhvovan29546 commentedon Dec 19, 2025
Hi @yuwenmemon @greg-schroeder please remove the Reviewing label and bump to Daily as payment is due
greg-schroeder commentedon Dec 19, 2025
Thanks @linhvovan29546
situchan commentedon Dec 19, 2025
BugZero Checklist:
[Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to comment: https://github.com/Expensify/App/pull/47203/changes#r2635874313
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion: N/A
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Link to issue:
Regression Test Proposal
Test case seems already exist
https://test-management.browserstack.com/projects/2219752/test-runs/TR-2158/folder/13176723/41237039/1035953069
situchan commentedon Dec 19, 2025
This is ready for payment
yuwenmemon commentedon Dec 19, 2025
Thanks! cc @greg-schroeder
greg-schroeder commentedon Dec 22, 2025
Paid via Upwork