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
[Due for payment 2026-02-03] [$250] Chat-Extra emojis appear with markdown * and _ #75294
🚨 Edited by proposal-police: This proposal was edited at 2025-11-25 12:20:18 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
When combining markdown formatting (* for bold, _ for italic) with emojis, extra duplicate emojis appear and the cursor jumps unexpectedly. For example, typing _****Test 😊****____ causes emojis to multiply (1 → 3 → 9).
What is the root cause of that problem?
The excludeRangeTypesFromFormatting function splits italic and strikethrough ranges at emoji boundaries, but does not split bold ranges. This creates overlapping ranges where bold extends past its parent italic range.
Where italic/strikethrough are split but bold is not:
JavaScript's substring(12, 10) swaps arguments and returns "😊" (duplicate emoji)
Why cursor jumps: Tree node positions become inconsistent because bold's range doesn't match the split italic ranges, causing getTreeNodeByIndex to return wrong nodes.
Why this doesn't reproduce on native (iOS/Android):
Native platforms use flat range application - they iterate through ranges independently and apply styles directly to text spans without nesting:
Android: SpannableStringBuilder applies each range independently
Web uses a nested DOM tree structure that requires proper parent-child relationships. Overlapping ranges break this structure.
Why bold was missed:
The original PR Expensify/react-native-live-markdown#591 "Prevent italic or strikethrough emojis on Android" focused on visual issues where italic/strikethrough styles would slant or strike through emojis. Bold doesn't visually distort emojis the same way, so it wasn't included. However, when bold + italic + emoji are combined, the inconsistent splitting creates overlapping ranges that break the web DOM builder. This was a missed edge case.
What changes do you think we should make in order to solve the problem?
Add bold to the list of markdown types that get split at emoji boundaries:
This ensures all inline text formatting types are consistently split at emoji boundaries, preventing overlapping ranges and fixing both the duplicate emoji and cursor positioning issues.
@sobitneupane@sonialiap 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]
[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:
[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.
Activity
melvin-bot commentedon Nov 17, 2025
Triggered auto assignment to @sonialiap (
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.TaduJR commentedon Nov 24, 2025
🚨 Edited by proposal-police: This proposal was edited at 2025-11-25 12:20:18 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
When combining markdown formatting (
*for bold,_for italic) with emojis, extra duplicate emojis appear and the cursor jumps unexpectedly. For example, typing_****Test 😊****____causes emojis to multiply (1 → 3 → 9).What is the root cause of that problem?
The
excludeRangeTypesFromFormattingfunction splitsitalicandstrikethroughranges at emoji boundaries, but does not splitboldranges. This creates overlapping ranges where bold extends past its parent italic range.Where italic/strikethrough are split but bold is not:
https://github.com/Expensify/react-native-live-markdown/blob/342a60cce84a79f227bbd9de282395498aab5241/src/parseExpensiMark.ts#L261-L262
Flow of the bug:
User types
_****Test 😊****____Parser generates ranges:
italic: 1-15(contains bold and emoji)bold: 5-12(contains emoji)emoji: 10-12excludeRangeTypesFromFormattingsplits italic at emoji but NOT bold:italic: 1-10(split before emoji)italic: 12-15(split after emoji)bold: 5-12(unchanged - now extends past first italic!)Web DOM builder unnests from italic (ends at 10) after processing emoji, but
lastRangeEndIndexis 12:https://github.com/Expensify/react-native-live-markdown/blob/342a60cce84a79f227bbd9de282395498aab5241/src/web/utils/parserUtils.ts#L285-L291
substring(12, 10)swaps arguments and returns"😊"(duplicate emoji)Why cursor jumps: Tree node positions become inconsistent because bold's range doesn't match the split italic ranges, causing
getTreeNodeByIndexto return wrong nodes.Why this doesn't reproduce on native (iOS/Android):
Native platforms use flat range application - they iterate through ranges independently and apply styles directly to text spans without nesting:
SpannableStringBuilderapplies each range independentlyhttps://github.com/Expensify/react-native-live-markdown/blob/342a60cce84a79f227bbd9de282395498aab5241/android/src/main/java/com/expensify/livemarkdown/MarkdownFormatter.java#L50-L52
NSMutableAttributedStringapplies each range independentlyhttps://github.com/Expensify/react-native-live-markdown/blob/342a60cce84a79f227bbd9de282395498aab5241/apple/MarkdownFormatter.mm#L20-L27
Web uses a nested DOM tree structure that requires proper parent-child relationships. Overlapping ranges break this structure.
Why bold was missed:
The original PR Expensify/react-native-live-markdown#591 "Prevent italic or strikethrough emojis on Android" focused on visual issues where italic/strikethrough styles would slant or strike through emojis. Bold doesn't visually distort emojis the same way, so it wasn't included. However, when bold + italic + emoji are combined, the inconsistent splitting creates overlapping ranges that break the web DOM builder. This was a missed edge case.
What changes do you think we should make in order to solve the problem?
Add
boldto the list of markdown types that get split at emoji boundaries:https://github.com/Expensify/react-native-live-markdown/blob/342a60cce84a79f227bbd9de282395498aab5241/src/parseExpensiMark.ts#L261-L262
Change:
This ensures all inline text formatting types are consistently split at emoji boundaries, preventing overlapping ranges and fixing both the duplicate emoji and cursor positioning issues.
[-]Chat-Extra emojis appear with markdown * and _[/-][+][$250] Chat-Extra emojis appear with markdown * and _[/+]melvin-bot commentedon Nov 25, 2025
Job added to Upwork: https://www.upwork.com/jobs/~021993280488912648126
melvin-bot commentedon Nov 25, 2025
Triggered auto assignment to Contributor-plus team member for initial proposal review - @sobitneupane (
External)TaduJR commentedon Nov 25, 2025
Demo of Proposal
https://www.loom.com/share/6bce2e599b6b49c3aa21c0896d4f46d3
57 remaining items
melvin-bot commentedon Jan 27, 2026
@sobitneupane @sonialiap 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]
sonialiap commentedon Feb 3, 2026
Payment summary:
@sobitneupane $250 please request in NewDot and please complete the checklist
@TaduJR $250 paid in upwork
TaduJR commentedon Feb 3, 2026
Thanks @sonialiap
Offer Accepted!
melvin-bot commentedon Feb 3, 2026
Payment Summary
Upwork Job
BugZero Checklist (@sonialiap)
sonialiap commentedon Feb 10, 2026
@sobitneupane bump on completing the checklist :) - #75294 (comment)
sonialiap commentedon Feb 16, 2026
@sobitneupane bump on the checklist #75294 (comment)
sobitneupane commentedon Feb 19, 2026
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: Fix moving cursor to the end of line react-native-live-markdown#729
[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:
[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: https://github.com/Expensify/Expensify/issues/601930
Regression Test Proposal
Test:
_****Test 😊****_____at the start (left)Do we agree 👍 or 👎
Zapier Logs
Run ID: 00040eee-ed01-aed9-c515-ce91efc27a14sonialiap commentedon Feb 19, 2026
Thanks!
garrettmknight commentedon Mar 16, 2026
$250 approved for @sobitneupane