[Due for payment 2026-12-08] [$175] Inline editing an expense description strips line breaks and Markdown
Editing an expense description inline on desktop flattens it to plain text. Saving even a small edit overwrites the original line breaks and Markdown.
This is follow-up #3 from #82534, tracked separately as discussed here. The line-break issue was also reported in #88651 and deferred to a follow-up.
Action Performed
- On desktop, create an expense and set its description from the expense details page:
Client dinner with *Acme Corp* Attendees: John, Sarah - Open the expense table in the report or Search and click the Description cell to edit it inline.
- Add
!at the end and press Enter to save. - Reopen the expense details.
Expected Result
The description keeps its line break and Acme Corp stays bold. Only the ! is added.
Actual Result
The editor shows one line of plain text. The saved description is Client dinner with Acme Corp Attendees: John, Sarah!, without the line break or bold formatting.
Workaround
Edit the description from the expense details page instead of the table cell.
Issue Owner
Current Issue Owner: @ahmedGaber93Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~022126005378281164602
- Upwork Job ID: 2126005378281164602
- Last Price Increase: 2026-11-26
cc @ahmedGaber93
Current assignee @ahmedGaber93 is eligible for the External assigner, not assigning anyone new.
Job added to Upwork: https://www.upwork.com/jobs/~022126005378281164602
Proposal
What is the root cause of that problem?
The inline editor uses the display-only, flattened description as its editable value. Stored formatting is removed and line breaks become spaces before editing begins. Adding ! then saves that entire flattened value, replacing the original description.
There is also an input configuration gap: descriptions are treated as multiline in the change handler, but the actual input is not configured as multiline.
Confidence: Medium — both table paths and the save pipeline were traced in code; browser reproduction was not performed.
Code evidence
- Formatting is lost before editing:
MerchantCell.tsx:34–55applieshtmlToTextandlineBreaksToSpaces, then passes the result intouseInlineEditState. Its description change handler already preserves incoming text; the merchant-only sanitizer is not the cause. - The input remains single-line:
MerchantCell.tsx:87–109supplies neither multiline nor auto-growing configuration. - A small edit commits the whole damaged value:
useInlineEditState.ts:59–77callsonSave(localValue)when it differs from the initial value. Opening and leaving unchanged should not save. - Saving cannot recover deleted formatting:
UpdateMoneyRequest.ts:1603–1652parses that replacement and sends it as the updated description. - Both Search and report tables use the shared transaction-row editing implementation.
What changes do you think we should make in order to solve the problem?
Separate the table preview from the editable description:
- Keep the existing single-line, plain-text preview.
- Initialize description editing with HTML converted back to Markdown, matching the full description page—not raw stored HTML.
- Configure descriptions as multiline inputs, preferably using the existing Markdown input. Preserve Enter-to-save, blur-to-save, Escape cancellation, and merchant-specific behavior.
- Add regression coverage for formatted multiline descriptions, appending
!, unchanged blur, cancellation, multiline paste, and unchanged merchant behavior. Verify both Search and report tables on web.
Reference implementation and validation
The full description page already converts stored HTML to editable Markdown and uses an auto-growing Markdown input.
Browser verification should specifically check that enabling multiline preserves existing line breaks while plain Enter still saves.
What alternative solutions did you explore?
- Use raw stored HTML: Incorrect—the editable representation should be Markdown, as in the full editor.
- Change only the initial value: Incomplete—the input must also support multiline content, and the preview must remain separate.
- Investigate response ordering: This cannot explain formatting already missing before save.
Related issues: Expense description reverts after saving concerns stale values after saving; Rules Markdown is not saved concerns a separate rule-writing path. Neither is established as a duplicate.
Next Steps for Contributor+ team:
To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/108117) to create a draft PR.
To refine: @MelvinBot <your feedback>
To reject: Explain why you are rejecting Melvin's proposal.
@ahmedGaber93, is the $175 bounty still available to an external contributor for #108117, or do you plan to have Melvin implement its proposal? I can verify the behavior in both the report and Search tables and add a regression test covering a formatted, multiline description.
Hamidou Anne
📣 @hamidouanne77-arch! 📣 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:
- Make sure you've read and understood the contributing guidelines.
- Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
- Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
- Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>
Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~01c2c6c9e79bc6ca14
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
Proposal
Please re-state the problem that we are trying to solve in this issue.
When inline-editing an expense Description cell in desktop tables (both Report and Search tables), the cell strips Markdown formatting and flattens line breaks into spaces as soon as editing starts. Making any edit and saving overwrites the stored HTML description with that flattened plain text.
What is the root cause of that problem?
In src/components/TransactionItemRow/DataCells/MerchantCell.tsx, MerchantOrDescriptionCell conflates the single-line plain-text display value with the editable description value and leaves the underlying TextInput single-line:
- Display-only plain text is fed into
useInlineEditState(MerchantCell.tsx:34-44):const text = !isDescription ? merchantOrDescription : StringUtils.lineBreaksToSpaces(Parser.htmlToText(merchantOrDescription));textstrips HTML formatting viaParser.htmlToTextand collapses newlines viaStringUtils.lineBreaksToSpaces, then passes that flattened string as the initial edit buffer touseInlineEditState. In contrast, the full description editor (src/pages/iou/request/step/DynamicIOURequestStepDescription.tsx:95-97) converts stored HTML into editable Markdown viaParser.htmlToMarkdown(...). - Single-line
TextInputstrips newlines even thoughisMultilineInputis declared (MerchantCell.tsx:46, 87-103):const isMultilineInput = isDescription;is only checked inhandleChangeText(lines 48-55) and is never forwarded to<TextInput>. Withoutmultiline/autoGrowHeight/type="markdown", React Native Web renders a single-line<input>, which stripsimmediately. - Display rendering currently binds to
localValue(MerchantCell.tsx:106-112):<TextWithTooltip text={localValue} numberOfLines={1} ... />renderslocalValuedirectly when not editing. OnceuseInlineEditStatebuffers Markdown for descriptions, bindingTextWithTooltiptolocalValuewould leak raw Markdown syntax (e.g.,*Acme Corp*) and raw newlines into the collapsed table cell. - Inline-cell input styles conflict with auto-growing Markdown height (
src/styles/index.ts:1565-1574&src/components/TextInput/BaseTextInput/implementation/index.tsx:370-372, 417-428):styles.editableCellInputStylesetsheight: '100%'on bothtextInputContainerStylesandtouchableInputWrapperStyle. InsideBaseTextInput,isAutoGrowHeightMarkdownalso applies{minHeight: variables.componentSizeLarge}andpb2/pb1padding. PassingautoGrowHeight+type="markdown"without a multiline-safe cell override causes fixed-height clipping or vertical row jumps on single-line descriptions.
What changes do you think we should make in order to solve the problem?
-
Decouple display preview from the editable Markdown buffer in
src/components/TransactionItemRow/DataCells/MerchantCell.tsx:- Keep the collapsed single-line plain-text preview separate:
const displayText = !isDescription ? merchantOrDescription : StringUtils.lineBreaksToSpaces(Parser.htmlToText(merchantOrDescription)); const editableValue = !isDescription ? merchantOrDescription : Parser.htmlToMarkdown(merchantOrDescription); - Pass
editableValueintouseInlineEditState(...)so opening inline edit loads Markdown with preserved line breaks (Client dinner with *Acme Corp* Attendees: John, Sarah), matchingDynamicIOURequestStepDescription.tsx:95-97and satisfyingcontainsHtmlTagvalidation insrc/libs/actions/TransactionInlineEdit.ts:329-332(editTransactionDescriptionInline). - Pass
text={isDescription ? displayText : localValue}to<TextWithTooltip>so both wide table cells (TransactionItemRowWide.tsx:461) and narrow titles (TransactionItemRowNarrowTitle.tsx:36) continue rendering clean single-line plain text when not editing (and refresh immediately via optimistic Onyx writes fromupdateMoneyRequestDescription). - Align description normalization in
getNormalizedValuewitheditTransactionDescriptionInline(StringUtils.removeInvisibleCharacters(value)for descriptions, which retains internalvia.split(' ')...join(' ').trim(), keepingvalue.trim()for merchants) so opening and blurring without real edits or adding only trailing invisible characters does not trigger redundantUPDATE_MONEY_REQUEST_DESCRIPTIONcalls.
- Keep the collapsed single-line plain-text preview separate:
-
Enable auto-growing Markdown multiline editing for descriptions in
MerchantCell.tsxwhile keepingEnterto save andShift+Enterfor newlines:- When
isDescriptionis true, passtype="markdown",multiline,autoGrowHeight, andmaxAutoGrowHeight={variables.textInputAutoGrowMaxHeight}to<TextInput>(leaving merchant editing unchanged as single-line). - Add an
onKeyPresshandler forisDescriptionon web (followingSearchNLFilterContent.tsx:125-136, guarded withisEnterWhileComposition):- Plain
Enter(withoutshiftKeyand not composing):e.preventDefault(); save();so pressingEntersaves without inserting an unwanted trailing newline. Shift+Enter: allowed through so users can insert new lines inline.Escape: continues callinghandleEscapeviauseKeyboardShortcut, resetting toeditableValuewithout saving.
- Plain
- Add a multiline-safe style adjustment (e.g.,
height: 'auto'and compactminHeightmatchingeditableCellHeight/0instead ofheight: '100%'andcomponentSizeLarge) for the description inline editor so single-line descriptions keep compact row height while multi-line descriptions expand cleanly up tomaxAutoGrowHeightand scroll internally, preservinghandleFocus(scrollToBottom+moveSelectionToEnd).
- When
-
Add unit/component regression tests:
- Cover
MerchantOrDescriptionCellwithisDescriptionfor:- Stored HTML with Markdown +
<br />(e.g.,Client dinner with <strong>Acme Corp</strong><br />Attendees: John, Sarah): collapsedTextWithTooltipshows plain single-line text, entering edit mode populates Markdown with, appending!and pressingEntercallsonSavewith Markdown +intact. Shift+Enterinserts a newline without saving; IME compositionEnterdoes not prematurely save.- Blur without edits does not call
onSave;Escapecancels and restoreseditableValue. - Merchant cell (
isDescription={false}) keeps single-line sanitization (lineBreaksToSpaces) and trimming unchanged.
- Stored HTML with Markdown +
- Verify end-to-end in both Report and Search tables on desktop web.
- Cover
What alternative solutions did you explore? (Optional)
- Initializing the editor with raw stored HTML (
merchantOrDescription): Rejected — users would see raw tags like<strong>/<br />, andeditTransactionDescriptionInline(src/libs/actions/TransactionInlineEdit.ts:330) explicitly rejects HTML tags withcommon.error.invalidCharacter. - Using
autoGrowSingleLineonBaseTextInput: Rejected —BaseTextInput'sautoGrowSingleLineinterceptsShift+Enterto submit (src/components/TextInput/BaseTextInput/index.tsx:22-32), which would prevent inserting line breaks in multiline descriptions. - Plain multiline
TextInputwithouttype="markdown": Works for preserving Markdown characters as raw text, buttype="markdown"matchesDynamicIOURequestStepDescription.tsx:244so users get live Markdown formatting and consistentHtmlPasteHandlerpaste behavior when editing descriptions inline.
📣 @elghaffaryoussef1-dotcom! 📣 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:
- Make sure you've read and understood the contributing guidelines.
- Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
- Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
- Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>
Proposal
What is the root cause of that problem?
There are three causes in MerchantCell.tsx, the cell used for the Description column.
-
The editor starts from the display text. L34 turns the stored HTML into plain text and turns line breaks into spaces. That one value is passed to
useInlineEditState(L39-44). It becomeslocalValue, which is both the editor value (L90) and the preview text (L106-112). The hook also resetslocalValueto this same value (L35-38, L46-51). Any edit then sends the flattened text througheditTransactionDescriptionInlinetoupdateMoneyRequestDescription, which parses it as Markdown. The*marks and line breaks are already gone, so the saved HTML is one plain line. The description page does it right: it editsParser.htmlToMarkdown(...)in a Markdown input that grows. -
The input is single-line. L46 sets
isMultilineInputfor descriptions, but it is only used inhandleChangeText. TheTextInput(L87-103) gets nomultiline,autoGrowHeightortype="markdown", so on web it renders a single-line<input>(BaseTextInput L348, L563). The browser drops line breaks from a single-line input by itself. So fixing only cause 1 would still lose line breaks. -
The cell style blocks a taller input. The cell passes
editableCellInputStyle(L99-100), which setsheight: '100%'. That pins the input to the row height, so a multi-line description cannot be shown even if the input were multi-line.
What changes do you think we should make in order to solve the problem?
All changes are in MerchantCell.tsx, for descriptions only. Merchant stays as it is.
-
Split the preview from the edit value.
- Edit value (passed to
useInlineEditState):Parser.htmlToMarkdown(description), the same as the description page. - Preview: compute
lineBreaksToSpaces(htmlToText(description))from the prop and pass it toTextWithTooltip, instead oflocalValue. If we only change the edit value, the one-line preview would show raw Markdown like*Acme Corp*. - Since the hook compares the new value with the edit value, opening and leaving without a change still does not save.
- Edit value (passed to
-
Make the input a growing Markdown input. Add
multiline,autoGrowHeight, amaxAutoGrowHeightandtype="markdown"to the descriptionTextInput. KeepsubmitBehavior="blurAndSubmit",onSubmitEditing={save}andonBlur={save}. With the existing react-native-websubmitBehaviorpatch, plain Enter saves and Shift+Enter adds a new line. Do not useautoGrowSingleLine: it makes Shift+Enter save too (BaseTextInput L20-37), so a user could never add a line. -
Let the description input grow. For descriptions, override
height: '100%'withheight: 'auto'and a max height that scrolls inside the input. A one-line description then looks like today's input, and a multi-line one gets a taller box. This matches the design direction in #83127 ("wrapped ones to be taller inputs and the ones that don't have a regular input"). The existinghandleFocusalready moves the cursor to the end and scrolls to the bottom, so long values open at the end. -
Tests (
MerchantCell/ inline edit tests):- Stored
Client dinner with <strong>Acme Corp</strong><br />Attendees: John, Sarah: the editor showsClient dinner with *Acme Corp*\nAttendees: John, Sarah, and adding!saves...*Acme Corp*\nAttendees: John, Sarah!. - The preview stays one line of plain text.
- Open and blur without a change does not save. Escape cancels.
- Merchant cell stays single-line and still turns pasted line breaks into spaces.
- Stored
Pseudo-code:
preview = isDescription ? lineBreaksToSpaces(htmlToText(value)) : value
editValue = isDescription ? htmlToMarkdown(value) : value
useInlineEditState(canEdit, editValue, ...)
TextInput: isDescription -> multiline, autoGrowHeight, maxAutoGrowHeight, type="markdown", height auto
TextWithTooltip text = preview
What alternative solutions did you explore? (Optional)
- Edit the stored HTML as is. Rejected: users would see
<strong>and<br />tags, andeditTransactionDescriptionInlinerejects HTML tags. - Open the full description page from the cell when the description has several lines or Markdown. Rejected: it works, but it drops inline editing for those expenses, which is the feature this follow-up is for.
Proposal
Please re-state the problem that we are trying to solve in this issue.
On desktop, inline-editing an expense description from the expense table (report table or Search) flattens it to plain text: saving even a tiny edit (e.g. adding !) overwrites the original description, losing its line breaks and Markdown formatting (e.g. Acme Corp bold). Editing from the full expense details page does not lose formatting.
What is the root cause of that problem?
I verified the diagnosis against the code on main. The formatting is destroyed before editing even begins, in MerchantOrDescriptionCell (src/components/TransactionItemRow/DataCells/MerchantCell.tsx), which renders both the merchant and the description cells:
// MerchantCell.tsx:34 — the description's editable initial value
const text = !isDescription ? merchantOrDescription : StringUtils.lineBreaksToSpaces(Parser.htmlToText(merchantOrDescription));
Parser.htmlToText strips the Markdown formatting and lineBreaksToSpaces turns newlines into spaces, and this flattened string is passed as the initial value to useInlineEditState (lines 39-44). From then on the editor only knows the damaged value, so any save overwrites the original description with it.
There is a second, independent defect in the same file. The component already computes const isMultilineInput = isDescription; (line 46) and the change handler already preserves text for multiline inputs (lines 50-55) — but isMultilineInput is never passed to the
- In MerchantOrDescriptionCell, initialize description editing with Markdown, not flattened plain text: use Parser.htmlToMarkdown(merchantOrDescription) (available at src/libs/Parser.ts:38) as the initial value for descriptions — the same representation the full description page already uses for editing. Keep the existing single-line plain-text preview for display (TextWithTooltip with numberOfLines={1}).
- Pass multiline (with auto-growing height) to the
when isDescription is true, so line breaks can be entered and displayed while editing. Preserve the existing behavior: Enter to save, blur to save, Escape to cancel, and the merchant-specific sanitization (line-break stripping and trimming) untouched for non-description cells. - Add regression tests for formatted multiline descriptions: append ! to a bold two-line description and verify the line break and bold survive; opening and blurring unchanged saves nothing; Escape cancels; multiline paste keeps line breaks; merchant editing behavior unchanged. Verify on both the report table and Search, on web. What alternative solutions did you explore? (Optional) • Using the raw stored HTML as the editable value: rejected — the editable representation should be Markdown, matching the full description page. • Changing only the initial value without making the input multiline: rejected — the input must also accept multiline content, otherwise newlines still cannot be entered or displayed while editing. • Fixing only the save side (e.g. merging the saved value with the original formatting): rejected — once the editor starts from a flattened value, the original formatting is unrecoverable at save time; the fix belongs at initialization. QA steps (to verify the fix)
- On desktop web, create an expense with a two-line description containing bold Markdown (e.g. Client dinner with Acme Corp + Attendees: John, Sarah).
- In the report expense table, click the Description cell, append !, press Enter, then reopen the expense details: the line break and bold formatting are preserved, only ! was added.
- Repeat from the Search table with the same result.
- Open the description cell and blur without changing anything: no save happens and the description is untouched. Press Escape mid-edit: the edit is cancelled.
- Regression: inline-edit a merchant (single-line) and confirm line breaks are still stripped and values are still trimmed as before.
@ahmedGaber93, is the $175 bounty still available to an external contributor for https://github.com/Expensify/App/issues/108117
@hamidouanne77-arch We only review external proposals on issues with "Help wanted" label, so for now we will work with Melvin to fix this.
@MelvinBot implement this with these design requirements from the v1 inline-edit PR (#83127):
Design requirements
- A description that fits on one line opens in a regular one-line input, at the same height as the cell. It must not open at 2 lines or jump in height (Shawn: "It should start off as just 1 line and only grow as you add enough text to make it grow to a second line").
- A description that wraps or has several lines gets a taller input that grows as you type (Jon: "we'd want the wrapped ones to be taller inputs and the ones that don't have a regular input").
- The cursor is at the end of the text when the input opens (Shawn).
- Line breaks and Markdown are kept: edit the description as Markdown (
Parser.htmlToMarkdown), like the description page. While not editing, the table still shows one line of plain text.
🤖 Web test steps verification results: ❌ fail
Infrastructure blocker; no product verdict. The browser session lost its connection and displayed a blank page, preventing verification.
| Step | Status |
|---|---|
Create formatted, two-line descriptionBlocked by disconnected browser session. |
⚠️ |
Report table preserves formatting and newline after saveUnverified. |
⚠️ |
Search table preserves formatting and newline after saveUnverified. |
⚠️ |
Short editor retains cell heightUnverified. |
⚠️ |
Short description opens on one lineUnverified. |
⚠️ |
Cursor opens at the endUnverified. |
⚠️ |
Wrapped/multiline descriptions open tallerUnverified. |
⚠️ |
Editor grows while typingUnverified. |
⚠️ |
Shift+Enter inserts a newlineUnverified. |
⚠️ |
Preview remains single-line plain textUnverified. |
⚠️ |
Unchanged blur preserves descriptionUnverified. |
⚠️ |
Escape cancels editingUnverified. |
⚠️ |
Multiline paste retains newlinesUnverified. |
⚠️ |
Merchant remains single-lineUnverified. |
⚠️ |
Implemented in draft PR: Preserve Markdown and line breaks when inline editing expense descriptions, assigned to ahmedGaber93.
Passed: 180 relevant tests, TypeScript, lint, formatting, spelling, unused-style analysis, and Storybook smoke checks. Full Jest and changed-file compiler checks timed out. Browser verification remains required before marking ready for review.
view run · no recording available
Deploy Blocker https://github.com/Expensify/App/issues/108462 was identified to be related to the PR https://github.com/Expensify/App/pull/108137 that attempted to fix this issue.
@ahmedGaber93
The solution for this issue has been :rocket: deployed to production :rocket: in version 9.5.56-2 and is now subject to a 7-day regression period :calendar:. Here is the list of pull requests that resolve this issue:
- https://github.com/Expensify/App/pull/108137
If no regressions arise, payment will be issued on 2026-12-08. :confetti_ball:
The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the Contributor+ 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]. If no checklist is needed for this issue, you can click: [no checklist button]