Skip to content

[Due for payment 2026-10-20] [$175] Pressing the Arrow Up key while viewing consecutive report previews causes a message located below the previews to enter edit mode, but the page does not automatically scroll to or focus the message being edited. #99760

Closed

Description

@m-natarajan

If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.


Version Number:
Reproducible in staging?: Needs Reproduction (Unable to reproduce)
Reproducible in production?: Needs Reproductuion
If this was caught during regression testing, add the test name, ID and link from BrowserStack:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: @FitseTLT
Slack conversation (hyperlinked to channel name): #Expensify bugs

Action Performed:

Preconditions
Have a workspace chat with multiple consecutive report previews.
Have a text message below the report previews.

Steps to Reproduce:

  1. Navigate to the workspace chat.
  2. Scroll to the area containing the consecutive report previews.
  3. Press the Arrow Up key.
  4. Observe the message below the report previews.

Expected Result:

The message that enters edit mode should automatically scroll into view and receive focus.

Actual Result:

A message located below the report previews enters edit mode, but the page does not auto-scroll to the message or automatically focus it.

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

Screenshots/Videos

2026-08-28.16-52-36.mp4
2026-08-28.00-13-15.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @FitseTLT

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Aug 28, 2026
  2. exfy-zapier commented on Aug 28, 2026

    @exfy-zapier

    This has been labelled "Needs Reproduction". Follow the steps here: https://stackoverflowteams.com/c/expensify/questions/16989

  3. MelvinBot commented on Aug 28, 2026

    @MelvinBot
    Contributor

    Proposal

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

    Pressing ArrowUp in an empty composer correctly puts the newest editable text message into edit mode even when several consecutive report previews sit above it — but on desktop web the list does not auto-scroll to that message and the edit input does not get focus.

    What is the root cause of that problem?

    The action selection is correct: useLastEditableAction.ts:31 skips report previews (they fail canEditReportAction) and lands on the newest text message — matching the repro.

    The real problem is that on desktop web there is no code that scrolls the list to a message when it enters edit mode. The scroll-into-view + focus rely entirely on the inline editor mounting:

    • ArrowUp only writes a draft, with no follow-up scroll — ComposerWithSuggestions.tsx:644-649.
    • Focus (and the browser's native scroll-into-view) fires only when ReportActionItemMessageEdit mounts (autoFocus + focusComposerWithDelay on mount).
    • The report actions list is a virtualizing FlashList with a finite drawDistance={1500}. When the user has scrolled up past several tall consecutive report previews, the newest text message (bottom of the list) is far outside the render window and is not mounted, so its editor never renders → no focus, no scroll.
    • The one edit-start scroll that would fix this is gated to mobile Chrome only, so desktop web (the affected platform) is excluded — ReportActionItemMessageEdit.tsx:445-447.

    Multiple consecutive report previews matter because they are tall, which is what pushes the target message outside the render window.

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

    When a persisted action enters edit mode, trigger a scroll to that action on desktop web too, not just mobile Chrome. The narrowest change is to broaden the existing gate at ReportActionItemMessageEdit.tsx:445-447 so it also runs on web — but because the target row can be virtualized out (unmounted), the onFocus path can't be relied on. The more robust fix is to call reportScrollManager.scrollToIndex(index) right after saveReportActionDraft in ComposerWithSuggestions.tsx, with an onScrollToIndexFailed fallback (the item is unmeasured while off-screen), so the row mounts, focus lands, and the message scrolls into view.

    Investigation details & evidence

    Data flow of the bug

    1. User scrolls up so tall consecutive report previews fill the viewport; the newest text message (FlashList index 0) is virtualized out (beyond drawDistance 1500).
    2. ArrowUp in the empty composer → saveReportActionDraft for the newest editable action (correctly skipping report previews). No scroll call follows.
    3. The message is "editing" in Onyx, but its ReportActionItem / ReportActionItemMessageEdit is not mounted.
    4. autoFocus and the mount-time focus effect never run → no focus, and no browser-native scroll-into-view.
    5. No desktop-web scroll-on-edit-start exists (the only one is isMobileChrome-gated) → no auto-scroll.

    Why not the other scroll paths

    • The Concierge streamed-draft autoscroll (useReportActionsScroll.ts) only fires for useConciergeDraft, not regular edits.
    • useEditMessage.ts:58-62 scrolls to index 0 only when leaving an edit, not entering.
    • The row index handed to FlashList is the true data index, so scrollToIndex(index) targets the correct row — the issue is that no scroll is called and the cell isn't mounted, not a wrong offset.

    One thing to confirm during implementation: whether the target row is genuinely unmounted (virtualized out) versus mounted-but-just-below-the-fold at the scroll position in the issue video. Either way the fix is the same — issue a scroll on edit-start for web — but it determines whether onScrollToIndexFailed handling is required.

    Confidence: Medium-High — strong, consistent code evidence across two independent traces; a live in-app reproduction was attempted but blocked by an unrelated dev-environment issue (the test browser rendered a blank page), so this is not yet confirmed by runtime observation.


    Next Steps for Contributor+ team:
    To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/99760) to create a draft PR.
    To refine: @MelvinBot <your feedback>
    To reject: Explain why you are rejecting Melvin's proposal.


    view run

  4. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Aug 28, 2026
  5. melvin-bot commented on Aug 28, 2026

    @melvin-bot

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

  6. melvin-bot commented on Aug 28, 2026

    @melvin-bot

    Unable to auto-create job on Upwork. The BZ team member should create it manually for this issue.

  7. FitseTLT commented on Aug 28, 2026

    @FitseTLT
    Contributor

    @ChavdaSachin If u cannot reproduce it as a reporter I can take over 👍

  8. ChavdaSachin commented on Aug 30, 2026

    @ChavdaSachin
    Contributor

    Sure @FitseTLT.
    Please take over.

    Thanks.

  9. FitseTLT commented on Aug 31, 2026

    @FitseTLT
    Contributor

    @mallenexpensify U can assign me here

  10. melvin-bot commented on Sep 2, 2026

    @melvin-bot

    @ChavdaSachin Whoops! This issue is 2 days overdue. Let's get this updated quick!

  11. 32 remaining items

  12. melvin-bot commented on Oct 13, 2026

    @melvin-bot

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

  13. melvin-bot commented on Oct 15, 2026

    @melvin-bot

    @FitseTLT 6 days overdue. This is scarier than being forced to listen to Vogon poetry!

  14. stitesExpensify commented on Oct 19, 2026

    @stitesExpensify
    Contributor

    @FitseTLT is there anything left here?

  15. FitseTLT commented on Oct 19, 2026

    @FitseTLT
    Contributor

    will apply payment label tomorrow

  16. FitseTLT commented on Oct 20, 2026

    @FitseTLT
    Contributor

    Proposed amount: $500 (2x the $250 job price — assigned 2026-08-28/31, before the Sep 19 price change, so $250 applies rather than the $175 currently shown on the label)

    Why the work exceeded the issue: The issue only asked for the Arrow-Up scroll/focus bug, fixed in #100432. During that PR's review I flagged a second, distinct bug — editing a message inside an expense report (or any report opened in a non-narrow RHP) incorrectly copies the text into the main composer instead of editing it inline. Design confirmed this was legit bug to be fixed (internal confirmation: #100432 (comment)) and asked for it to be fixed as a separate PR, which I did in #103350.

    Regressions caused by this PR: None — the 7-day regression period for #103350 ended 2026-10-20 with no regressions reported.

  17. FitseTLT commented on Oct 20, 2026

    @FitseTLT
    Contributor

    Contributor+ 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.

      Not applicable — this wasn't a regression traced to a specific prior PR. The root cause (per the accepted proposal) was a long-standing gap: desktop web never had a "scroll to message on edit-start" path (only mobile Chrome did), not something an identifiable PR broke.

      Link to the comment on the PR: N/A
      Link to the comment on the Issue: N/A

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

      Not applicable — not a regression, so no Slack discussion needed.

      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.

    Regression Test Proposal

    Precondition:

    • Have a workspace chat where there's a pending action awaiting the current user (e.g. a report waiting on Submit or Approve), positioned far enough up the chat history that opening the chat from the LHN scrolls/opens it to that pending action in the middle of the chat, not to the bottom.
    • Have 30+ more report actions after that pending-action preview, followed by an editable text message from the current user, so that message sits far enough below the render window to be virtualized out (unmounted) when the chat first opens.

    Test:

    1. On Desktop Web, open the chat from the LHN — it should load scrolled to the pending action in the middle of the chat history, with the editable message below not yet mounted.
    2. With the composer empty, press the Up Arrow key.
    3. Verify the app scrolls down to the editable message, the message enters edit mode, and the edit input is automatically focused.
    4. Open an expense report (or any report shown in the RHP on a wide/desktop screen) and edit one of your own messages.
    5. Verify the message is edited inline (in place) and its text is not copied into the main composer.

    Do we agree 👍 or 👎

  18. changed the title [-][$175] Pressing the Arrow Up key while viewing consecutive report previews causes a message located below the previews to enter edit mode, but the page does not automatically scroll to or focus the message being edited.[/-] [+][Due for payment 2026-10-20] [$175] Pressing the Arrow Up key while viewing consecutive report previews causes a message located below the previews to enter edit mode, but the page does not automatically scroll to or focus the message being edited.[/+] on Oct 20, 2026
  19. melvin-bot commented on Oct 20, 2026

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (Awaiting Payment)

  20. mallenexpensify commented on Oct 20, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor+: @FitseTLT due $500 via NewDot

    @stitesExpensify increasing price based on @FitseTLT 's reasoning above, comment if you disagree.

  21. flaviadefaria commented on Oct 23, 2026

    @flaviadefaria
    Contributor

    Approved: @FitseTLT due $500 via NewDot

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.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorNeeds ReproductionReproducible steps needed

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions