Skip to content

[Due for payment 2026-06-17] [$250] Chat - Cursor focuses at the beginning of the text after removing expense from report #90844

Closed

Description

@mitarachim

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: 9.3.74-7
Reproducible in staging?: Yes
Reproducible in production?: No
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #90516
Email or phone of affected tester (no customers): sdsdjoijdoisnjodis@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Mac 26.2 / Chrome
App Component: Money Requests

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to workspace chat.
  3. Create an empty report.
  4. Open the report.
  5. Send a message.
  6. Right click on the message > Edit comment.
  7. Click Add expense > Create expense.
  8. Create a manual expense.
  9. Click on the end of the message in the composer to focus it.
  10. Click Report field.
  11. Click Remove from report.

Expected Result:

The cursor will focus at the end of the text.

Actual Result:

The cursor focuses at the beginning of the text after removing expense from report.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7155307_1778866385595.8.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @mallenexpensify
Upwork Automation - Do Not Edit

Activity

  1. added
    DeployBlockerCashThis issue or pull request should block deployment
    BugSomething is broken. Auto assigns a BugZero manager.
    on May 15, 2026
  2. melvin-bot commented on May 15, 2026

    @melvin-bot

    @mountiny recently merged #90516, but they are OOO right now, so I'll auto-assign someone else.

  3. melvin-bot commented on May 15, 2026

    @melvin-bot

    Triggered auto assignment to @yuwenmemon (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

  4. github-actions commented on May 15, 2026

    @github-actions
    Contributor

    👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

    1. Identify the pull request that introduced this issue and revert it.
    2. Find someone who can quickly fix the issue.
    3. Fix the issue yourself.
  5. melvin-bot commented on May 15, 2026

    @melvin-bot

    💬 A slack conversation has been started in #expensify-open-source

  6. OSBotify commented on May 15, 2026

    @OSBotify
    Contributor

    Investigation Summary

    Classification: Frontend bug
    Causing PR: #90516 - "Allow editing messages in Composer on narrow screens V2" by @chrispader (High confidence)
    Related Issues: None

    Recommendation: REVERT

    PR #90516 significantly rewrote the message editing flow in ReportActionItemMessageEdit.tsx and introduced new context/focus management code. The cursor-at-beginning regression is a side effect of how the refactored code handles re-focus when the "Remove from report" modal closes.

    Assigned: @chrispader (PR author), @mountiny, @hungvu193 (approving reviewers)
    Labels: DeployBlockerCash kept (frontend App PR is the cause). No label changes made.

    Detailed Analysis

    Evidence

    Verification

    • Affected file: src/pages/inbox/report/ReportActionItemMessageEdit.tsx
    • Confirmed PR Allow editing messages in Composer on narrow screens V2 #90516 modifies this file (110 additions / 248 deletions).
    • Also affects: src/pages/inbox/report/ReportActionEditMessageContext.tsx (new file, 199 additions) and src/pages/inbox/report/ContextMenu/PopoverReportActionContextMenu.tsx.

    Root Cause

    When the user clicks "Remove from report" inside the IOURequestStepReport modal:

    1. The context menu/modal closes.
    2. PopoverReportActionContextMenu.performHide() calls refocusComposerAfterPreventFirstResponder('edit'), which invokes focusComposerWithDelay(editComposerRef)(true).
    3. After a delay, input.focus() is called on the edit composer without a forcedSelectionRange. On web, a bare focus() call resets the cursor to position 0 (beginning of text).
    4. The onSelectionChange callback fires with {start: 0, end: 0}, updating currentEditMessageSelection in ReportActionEditMessageContext to position 0.
    5. A useEffect in ReportActionItemMessageEdit (lines 123–127) re-runs when currentEditMessageSelection changes, calling setSelectionState({start: 0, end: 0}) — placing the cursor at the beginning.

    In the pre-PR version of ReportActionItemMessageEdit, the inline editing composer used a different selection management approach that did not propagate the transient focus() cursor reset back into persistent context state. The new ReportActionEditMessageContext and setCurrentEditMessageSelection mechanism introduced by PR #90516 causes the bare focus() reset to be persisted and re-applied via the useEffect.

  7. 69 remaining items

  8. melvin-bot commented on Jun 10, 2026

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (Awaiting Payment)

  9. melvin-bot commented on Jun 15, 2026

    @melvin-bot

    @mallenexpensify Huh... This is 4 days overdue. Who can take care of this?

  10. thelullabyy commented on Jun 15, 2026

    @thelullabyy
    Contributor

    BugZero Checklist:

    • [Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

      Link to the comment on the PR: NA
      Link to the comment on the Issue:

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

    Test:

    1. Go to staging.new.expensify.com
    2. Go to workspace chat.
    3. Create an empty report.
    4. Open the report.
    5. Send a message.
    6. Right click on the message > Edit comment.
    7. Click Add expense > Create expense.
    8. Create a manual expense.
    9. Click on the end of the message in the composer to focus it.
    10. Click Report field.
    11. Click Remove from report.
    12. Verify that the cursor will focus at the end of the text.

    Do we agree 👍 or 👎

    Zapier Logs Run ID: 00040eee-fa63-a815-90c1-bbb84bc25f14
  11. mallenexpensify commented on Jun 17, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor: @lorretheboy paid $250 via Upwork
    Contributor+: @thelullabyy paid $250 via Upwork

    @lorretheboy can you please accept the job below? Please reply here and tag me once you have.
    If you're not sent an offer in Upwork when you're assigned to an issue, please tag me. If an Upwork job exists, please submit a proposal.
    https://www.upwork.com/jobs/~022061730775210142925

    ^ Test case created. Thx

  12. lorretheboy commented on Jun 17, 2026

    @lorretheboy
    Contributor

    @mallenexpensify approved the offer

  13. mallenexpensify commented on Jun 18, 2026

    @mallenexpensify
    Contributor

    @lorretheboy paid, summary updated above. Thx.

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

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2EngineeringExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions