[$175] iOS Safari - Chat - Bold and italic formatting is lost when pasting rich text

Open
#106,033 7 comments 1 reaction 2 assignees View on GitHub

Maintainers usually reply within 1 day

@truph01 is already working on this.

Since Nov 4, 2026.

Assessment

This issue has not been assessed yet.

Description

Bug Daily External

Reproducible in staging?: Yes
Issue reported by: @Uzaifm127
Source: Follow-up from https://github.com/Expensify/App/issues/85907#issuecomment-6451147442 on Chat - Emojis pasted from Slack render as images

The Safari clipboard contains formatting information, but bold and italic text become plain text after pasting. This is separate from recognizing emoji images.

Action Performed:

  1. In Slack , enter a message containing an emoji and these three phrases: Bold,, Italic Bold,, and Italic.
  2. Use Slack's formatting controls to make Bold, bold, Italic Bold, both bold and italic, and Italic italic. Send the message and confirm that Slack displays those styles.
  3. Select and copy the whole rendered message.
  4. On iOS safari, open a chat.
  5. Clear the composer and paste the copied message.

Expected Result:

The pasted phrases retain the same bold and italic formatting shown in Slack.

Actual Result:

The words are pasted, but their bold and italic formatting is lost. The bold, bold-and-italic, and italic phrases appear as plain text.

Workaround:

Reapply the bold and italic formatting manually after pasting.

Platforms:

Platforms where the issue reproduced (other platforms not tested):

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari

Screenshots/Videos

https://github.com/user-attachments/assets/9348903e-7fe4-48a5-b74e-8c095ddeb5bd

Root cause
  1. Safari puts the bold and italic formatting on <span> elements. For example, Bold, has a bold style, and Italic Bold, has both bold and italic styles. The formatting is in the copied HTML, but not in <b>, <strong>, <i>, or <em> tags.
  2. handlePastedHTML() sends the HTML to Parser.htmlToMarkdown(): https://github.com/Expensify/App/blob/5bd95161056013f594b1c6f01e84f046433e7f6e/src/hooks/useHtmlPaste/index.ts#L186. The parser's bold and italic rules look for those tags, so they do not recognize the formatting on Safari's <span> elements.
  3. The parser removes the remaining HTML tags, leaving only the words. That is why Bold,, Italic Bold, and Italic appear in the Composer without their copied formatting.
Issue OwnerCurrent Issue Owner: @truph01
Upwork Automation - Do Not Edit
Dominant language
TypeScript
Stars
5k
Forks
4k
Avg merge
3d 7h
Merged PRs (30d)
561

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Expensify/App

All issues in Expensify/App

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.