Repository navigation
Description
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: v9.1.51-9
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/6048951&group_by=cases:section_id&group_order=asc&group_id=309131
Email or phone of affected tester (no customers): arkam2504+1tr@gmail.com
Issue reported by: Applause Internal Team
Device used: iOs 18 / iPhone 14 pro max
App Component: Chat Report View
Action Performed:
Preconditions: Account is created and the user is logged in
Steps to Reproduce:
- Navigate to this link -
App/src/components/TextInputFocusable/index.js
Lines 263 to 267 in 403fc28
if (files.length > 0) { // Prevent the default so we do not post the file name into the text box event.preventDefault(); this.props.onPasteFile(event.clipboardData.files[0]); return; - Copy the text highlighted in yellow
- Navigate to the Expensify app
- Paste the code into the compose box in a conversation
Expected Result:
The pasted code should retain original formatting:
- No extra space between lines.
- All lines left-aligned as in the source code.
Actual Result:
Extra line spacing appears between some lines.
Some lines, such as the second-to-last one, appear visually misaligned or more indented than the others.
Workaround:
Unknown
Platforms:
- Android: App
- Android: mWeb Chrome
- iOS: App
- iOS: mWeb Safari
- iOS: mWeb Chrome
- Windows: Chrome
- MacOS: Chrome / Safari
- MacOS: Desktop
Screenshots/Videos
1.mp4
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~021928524455201945661
- Upwork Job ID: 1928524455201945661
- Last Price Increase: 2025-05-30
- Automatic offers:
- nkdengineer | Contributor | 107550710

Activity
melvin-bot commentedon May 27, 2025
Triggered auto assignment to @OfstadC (
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.nkdengineer commentedon May 27, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
Extra line spacing appears between some lines.
Some lines, such as the second-to-last one, appear visually misaligned or more indented than the others.
What is the root cause of that problem?
We're using
white-space: preApp/src/components/HTMLEngineProvider/BaseHTMLEngineProvider.tsx
Line 71 in 156d892
for comment, so
Ref: https://developer.mozilla.org/en-US/docs/Web/CSS/white-space
What changes do you think we should make in order to solve the problem?
We should replace the white-space with
inApp/src/pages/home/report/comment/TextCommentFragment.tsx
Line 101 in 156d892
I referred this regex in https://github.com/Expensify/expensify-common/blob/14ba35584bb3619035c27368b2206842ee930aea/lib/ExpensiMark.ts#L183
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
UI issue
What alternative solutions did you explore? (Optional)
We can fix it in expensify-common
https://github.com/Expensify/expensify-common/blob/14ba35584bb3619035c27368b2206842ee930aea/lib/ExpensiMark.ts#L950
but I'm not sure if it cause the regression because it's used in too many places
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.
melvin-bot commentedon May 30, 2025
Job added to Upwork: https://www.upwork.com/jobs/~021928524455201945661
[-]Chat - Formatting is incorrect when pasting code into the compose box[/-][+][$250] Chat - Formatting is incorrect when pasting code into the compose box[/+]melvin-bot commentedon May 30, 2025
Triggered auto assignment to Contributor-plus team member for initial proposal review - @ZhenjaHorbach (
External)shakibwebx commentedon May 30, 2025
Proposal to Fix Issue #62848
Hi team,
To resolve the formatting inconsistency when pasting code into the chat compose box, I propose the following:
🛠 Technical Plan
The root cause is the use of white-space: pre in combination with how normal spaces are handled when rendering HTML. When pasting code, some white spaces collapse or appear uneven due to inconsistencies in how the browser interprets normal spaces vs non-breaking spaces.
To fix this:
Replace all normal spaces (excluding newlines) in the htmlWithTag string with , preserving indentation and preventing extra spacing between lines.
Implementation (in TextCommentFragment.tsx):
tsx
Copy
Edit
const formattedHTML = htmlWithTag.replace(/(?:(?![\n\r])\s)/g, ' ');
return ;
This will ensure:
Line breaks are preserved (\n, \r stay intact)
All visible spaces remain consistent
The change is localized to TextCommentFragment, minimizing regression risk
I will test this on:
Web (Chrome, Safari)
Android (native + Chrome)
iOS (native + Safari/Chrome)
Desktop (Electron)
I have already prepared the code diff and can proceed with implementation upon acceptance.
Let me know if this approach looks good!
Thanks,
Md Habibur Rahman
melvin-bot commentedon May 30, 2025
📣 @shakibwebx! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:
Format:
39 remaining items
MonilBhavsar commentedon Sep 10, 2025
Caused a regression #70166 @nkdengineer @ZhenjaHorbach
nkdengineer commentedon Sep 10, 2025
I'll check it soon
[-][$250] Chat - Formatting is incorrect when pasting code into the compose box[/-][+][Due for payment 2025-09-17] [$250] Chat - Formatting is incorrect when pasting code into the compose box[/+]melvin-bot commentedon Sep 10, 2025
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.2.8-4 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2025-09-17. 🎊
For reference, here are some details about the assignees on this issue:
melvin-bot commentedon Sep 10, 2025
@ZhenjaHorbach @OfstadC The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]
ZhenjaHorbach commentedon Sep 17, 2025
@OfstadC
We are ready for payment!
ZhenjaHorbach commentedon Sep 17, 2025
BugZero Checklist:
Bug classification
Source of bug:
Where bug was reported:
Who reported the bug:
[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: NA
[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: NA
[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.
Regression Test Proposal
Test:
Do we agree 👍 or 👎
OfstadC commentedon Sep 17, 2025
Payment Summary
ZhenjaHorbach commentedon Sep 17, 2025
Requested in ND!
flaviadefaria commentedon Sep 19, 2025
Approved $250 for @ZhenjaHorbach