Skip to content

[Due for payment 2025-08-05] [Awaiting Checklist] [Due for payment 2025-07-28] [$250] Text input field - Unable to paste text with CMD + v #63711

Closed

Description

@izarutskaya

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.60-3
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: @carlosmiceli
Slack conversation (hyperlinked to channel name): #expensify_quality

Action Performed:

  1. Go to https://staging.new.expensify.com/
  2. Log in > any chat
  3. Go to https://stackoverflow.com/questions/79630900/split-all-columns-in-half-by-character-position and copy using CMD + C list section from screenshot
  4. Come back to NewDot and past the text using CMD + V

Expected Result:

Original texts should display in compose box.

Actual Result:

Unable to paste text with CMD + v in compose box.

Workaround:

Unknown

Platforms:

Select the officially supported platforms where the issue was reproduced:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop
Platforms Tested: On which of our officially supported platforms was this issue tested:
  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Image

macOS_chrome_safari.mp4
Recording.135.2.mp4
Recording.3165.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021932087512760984775
  • Upwork Job ID: 1932087512760984775
  • Last Price Increase: 2025-07-08
  • Automatic offers:
    • nkdengineer | Contributor | 107965784
Issue OwnerCurrent Issue Owner: @garrettmknight

Activity

  1. added
    Daily
    Bug
    on Jun 6, 2025
  2. melvin-bot commented on Jun 6, 2025

    @melvin-bot

    Triggered auto assignment to @garrettmknight (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.

  3. dmkt9 commented on Jun 7, 2025

    @dmkt9
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    Unable to paste text with CMD + v in compose box.

    What is the root cause of that problem?

    1. When copying HTML content and pasting it into the Composer component, the pastedHTML will be truncated with a limit of maxLength = CONST.MAX_COMMENT_LENGTH + 1 (where CONST.MAX_COMMENT_LENGTH = 10000).
      const useHtmlPaste: UseHtmlPaste = (textInputRef, preHtmlPasteCallback, isActive = false, maxLength = CONST.MAX_COMMENT_LENGTH + 1) => {

      handlePastedHTML(pastedHTML);

      https://github.com/Expensify/expensify-common/blob/12c73695718b2359ea20755e6484a18677ab3094/lib/ExpensiMark.ts#L1245
    2. This has been explained here:
      https://github.com/Expensify/expensify-common/blob/12c73695718b2359ea20755e6484a18677ab3094/lib/ExpensiMark.ts#L1237-L1244

    What changes do you think we should make in order to solve the problem?

    1. Approach 1:

    • The long HTML text results from having a large number of style attributes, which are very lengthy.
    • The htmlToMarkdown function does not process these style attributes, causing them to remain in the input text and leading to performance issues during parsing.

    Solution:

    handlePastedHTML(pastedHTML.replaceAll(/(<style\b[^>]*>[\s\S]*?<\/style>)|(style\s*=\s*(["']).*?\3)/g, ""));

    2. Approach 2:
    Change maxLength accordingly.

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    N/A

    What alternative solutions did you explore? (Optional)

    N/A

    bandicam.2025-06-07.18-08-19-832.mp4
  4. added
    External
    on Jun 9, 2025
  5. changed the title [-]Text input field - Unable to paste text with `CMD + v`[/-] [+][$250] Text input field - Unable to paste text with `CMD + v`[/+] on Jun 9, 2025
  6. melvin-bot commented on Jun 9, 2025

    @melvin-bot
  7. added
    Help Wanted
    on Jun 9, 2025
  8. melvin-bot commented on Jun 9, 2025

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @jjcoffee (External)

  9. nkdengineer commented on Jun 9, 2025

    @nkdengineer
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    Unable to paste text with CMD + v in compose box.

    What is the root cause of that problem?

    For the too long content, we will truncate it in

    https://github.com/Expensify/expensify-common/blob/12c73695718b2359ea20755e6484a18677ab3094/lib/ExpensiMark.ts#L1236-L1247

    and the generatedMarkdown now can't be decoded in

    https://github.com/Expensify/expensify-common/blob/12c73695718b2359ea20755e6484a18677ab3094/lib/ExpensiMark.ts#L1259

    because it doesn't contain enough content to decode, so we can't see anything

    What changes do you think we should make in order to solve the problem?

    We should truncate the content only after decode

    1. Remove this block
    2. Truncate the final result
    let result = str_1.default.htmlDecode(this.replaceBlockElementWithNewLine(generatedMarkdown));
            if (maxBodyLength > 0) {
                /*
                 * Some HTML sources (such as Microsoft Word) have headers larger than the typical maxLength of
                 * 10K even for a small body text. So the text is truncated after extracting the body element, to
                 * maximise the amount of body text that is included while still staying inside the length limit.
                 */
                result = result.slice(0, maxBodyLength);
            }
            return result;
    

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    None

    What alternative solutions did you explore? (Optional)

    We can prevent to paste too long content (i.e. 20k characters)

    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.

  10. 98 remaining items

  11. melvin-bot commented on Jul 21, 2025

    @melvin-bot

    @justinpersaud @garrettmknight @jjcoffee / @nkdengineer 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]

  12. added
    Daily
    and removed
    Weekly
    on Jul 27, 2025
  13. garrettmknight commented on Jul 28, 2025

    @garrettmknight
    Contributor

    @jjcoffee please complete the checklist.

  14. garrettmknight commented on Jul 28, 2025

    @garrettmknight
    Contributor

    Payment summary:

  15. changed the title [-][Due for payment 2025-07-28] [$250] Text input field - Unable to paste text with `CMD + v`[/-] [+][Awaiting Checklist] [Due for payment 2025-07-28] [$250] Text input field - Unable to paste text with `CMD + v`[/+] on Jul 28, 2025
  16. nkdengineer commented on Jul 28, 2025

    @nkdengineer
    Contributor

    @garrettmknight I think you mentioned the wrong contributor

  17. added
    Weekly
    and removed
    Daily
    on Jul 29, 2025
  18. changed the title [-][Awaiting Checklist] [Due for payment 2025-07-28] [$250] Text input field - Unable to paste text with `CMD + v`[/-] [+][Due for payment 2025-08-05] [Awaiting Checklist] [Due for payment 2025-07-28] [$250] Text input field - Unable to paste text with `CMD + v`[/+] on Jul 29, 2025
  19. melvin-bot commented on Jul 29, 2025

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.86-3 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-08-05. 🎊

    For reference, here are some details about the assignees on this issue:

  20. melvin-bot commented on Jul 29, 2025

    @melvin-bot

    @jjcoffee @garrettmknight 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]

  21. jjcoffee commented on Aug 1, 2025

    @jjcoffee
    Contributor

    BugZero Checklist:

    • [Contributor] Classify the bug:
    Bug classification

    Source of bug:

    • 1a. Result of the original design (eg. a case wasn't considered)
    • 1b. Mistake during implementation
    • 1c. Backend bug
    • 1z. Other:

    Where bug was reported:

    • 2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
    • 2b. Reported on staging (eg. found during regression or PR testing)
    • 2d. Reported on a PR
    • 2z. Other:

    Who reported the bug:

    • 3a. Expensify user
    • 3b. Expensify employee
    • 3c. Contributor
    • 3d. QA
    • 3z. Other:
    • [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/expensify-common/pull/852/files#r2247302924

    • [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:

    1. Open any chat
    2. Go to https://stackoverflow.com/questions/79630900/split-all-columns-in-half-by-character-position and copy the text highlighted in the screenshot below, using CMD + C
    Image
    1. Come back to NewDot and paste the text using CMD + V
    2. Verify that the copied text is pasted in the composer.

    Do we agree 👍 or 👎

  22. trjExpensify commented on Aug 1, 2025

    @trjExpensify
    Contributor

    Approved $250 for @jjcoffee

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentBugExternalWeekly

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions