Skip to content

[Due for payment 2026-05-11] [Due for payment 2026-05-07] iOS - Chat - Context menu does not close after selecting Mark as unread #89069

Closed

Description

@jponikarchuk

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.64-0
Reproducible in staging?: Yes
Reproducible in production?: No
If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://test-management.browserstack.com/projects/2219752/test-runs/TR-23129/folder/13177078/41237899/1372516040?sort=%2Bidentifier
Email or phone of affected tester (no customers): n/a
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: iPhone 13 iOS 26.3.1
App Component: Chat Report View

Action Performed:

  1. Open the app
  2. Go to any conversation with some messages
  3. Long tap on any message
  4. Select Mark as unread

Expected Result:

Context menu closes after selecting Mark as unread option

Actual Result:

Context menu does not close after selecting Mark as unread option

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Video.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @mallenexpensify

Activity

  1. added
    DeployBlockerCash
    Bug
    on Apr 28, 2026
  2. melvin-bot commented on Apr 28, 2026

    @melvin-bot

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

  3. melvin-bot commented on Apr 28, 2026

    @melvin-bot

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

  4. github-actions commented on Apr 28, 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. OSBotify commented on Apr 28, 2026

    @OSBotify
    Contributor

    🔍 Investigation Summary

    Classification: Frontend bug
    Causing PR: #87155 - "[INTERNAl QA] Compact row styles for context menus and popovers" by @shawnborton (Low confidence)
    Related Issues: None identified

    Recommendation: NEEDS INVESTIGATION

    I was unable to pinpoint the exact root cause with high confidence. PR #87155 is the most significant change to BaseReportActionContextMenu.tsx in this staging cycle, but its changes appear to only affect wide-screen styling, making it an unlikely cause of an iOS-only regression.

    Assigned: @shawnborton (PR author), @shubham1206agra @Julesssss (approving reviewers) from highest-confidence causing PR
    Labels: DeployBlockerCash kept (frontend/App bug on iOS). No label changes made.

    📋 Detailed Analysis

    Evidence

    The bug is reproduced on iOS App only (staging version 9.3.64-0), not on production or any other platform. The context menu does not close after selecting "Mark as unread" from the long-press context menu on a message.

    Code path for "Mark as unread" (src/pages/inbox/report/ContextMenu/ContextMenuActions.tsx, line 470–474):

    onPress: (closePopover, {reportActions, reportAction, reportID, currentUserAccountID}) => {
        markCommentAsUnread(reportID, reportActions, reportAction, currentUserAccountID);
        if (closePopover) {
            hideContextMenu(true, ReportActionComposeFocusManager.focus);
        }
    },

    The hideContextMenu(true, ...) call uses shouldDelay=true which triggers an 800ms setTimeout before calling contextMenuRef.current.hideContextMenu(paramsWithCallback). After 800ms, it checks if the instanceIDRef.current still matches the saved instanceID before proceeding. If the instance ID was reset (because the popover was hidden and reshown), the close would be silently skipped.

    PR #87155 modified BaseReportActionContextMenu.tsx to wrap the entire content in a CompactMenuContext.Provider value (provides true to all platforms). While CompactMenuContext checks isCompactMenu && !isSmallScreenWidth, meaning compact styles do NOT apply on narrow/mobile screens, the provider is now active on iOS as well. This is the most direct change to the affected file in this staging cycle.

    Other candidates investigated:

    • No PRs from the staging list directly modified PopoverReportActionContextMenu.tsx, ReportActionContextMenu.ts, or the hideContextMenu function signature
    • No PRs changed useThrottledButtonState, which controls the 1800ms success-state display
    • The markCommentAsUnread function was not changed in this staging cycle

    Verification

    • The affected file src/pages/inbox/report/ContextMenu/BaseReportActionContextMenu.tsx was modified by PR [INTERNAl QA] Compact row styles for context menus and popovers #87155 (92 additions, 88 deletions)
    • The close path uses hideContextMenu(true, ...) from src/pages/inbox/report/ContextMenu/ReportActionContextMenu.ts line 80
    • On iOS native, the context menu is rendered as a BOTTOM_DOCKED modal (src/components/Popover/index.native.tsx)
    • The bug is iOS App-only — Android, mWeb, and desktop are not affected

    Root Cause

    The exact root cause is unclear from static code analysis. Possible explanations:

    1. PR [INTERNAl QA] Compact row styles for context menus and popovers #87155 (low confidence): The CompactMenuContext.Provider value wrapper added to BaseReportActionContextMenu.tsx may be interacting with the iOS BOTTOM_DOCKED modal's render cycle in an unexpected way, potentially causing a re-render that interferes with the 800ms close timer's instance ID check.

    2. Pre-existing iOS edge case exposed: The 800ms shouldDelay timer in hideContextMenu(true, ...) + the 1800ms throttled button state timer (for the success checkmark display) could be creating a race condition specific to iOS's rendering/animation cycle that was exposed by some other recent change.

    3. Mobile-Expensify submodule: The staging deploy includes Mobile-Expensify updates (9.3.63-1 and 9.3.64-0) that could contain iOS-native changes affecting modal close behavior.

    The PR author @shawnborton and reviewing engineers should verify whether PR #87155 introduced this iOS regression. If not, deeper investigation into the Mobile-Expensify submodule changes may be warranted.

  6. MelvinBot commented on Apr 28, 2026

    @MelvinBot
    Contributor

    Proposal

    What is the root cause of that problem?

    When "Mark as unread" is tapped, markCommentAsUnread() fires an Onyx.merge on the report (updating lastReadTime) before hideContextMenu(true, ...) runs its 800ms delayed close.

    The true parameter triggers a delayed hide path that captures instanceIDRef.current and checks it again after 800ms — if the ID changed (due to the popover remounting from the Onyx-triggered re-render), the close is silently skipped.

    Other actions that use hideContextMenu(true, ...) (Copy URL, Copy text, Copy email) only write to the clipboard — no Onyx updates, no re-renders, so the instanceID stays stable. "Mark as unread" is unique in triggering an Onyx merge before the delayed close.

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

    Move markCommentAsUnread() into the onHide callback so it runs after the popover closes, preventing re-renders during the 800ms delay window. This matches the pattern used by other actions like "Reply in thread" which perform their work inside the callback:

    In ContextMenuActions.tsx:470-475, change the onPress to:

    hideContextMenu(true, () => {
        markCommentAsUnread(reportID, reportActions, reportAction, currentUserAccountID);
        ReportActionComposeFocusManager.focus();
    });
    

    What alternative solutions did you explore? (Optional)

    1. Use hideContextMenu(false, ...) — closes immediately without delay, but loses the checkmark success animation that the successIcon: 'Checkmark' field provides.
    2. Weaken the instanceID guard — make setTimeout callback more resilient to re-renders, but this would mask future bugs where the guard is genuinely needed.

    The callback approach is safest because it preserves the success animation while ensuring the Onyx update can't interfere with the close.


    Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot <your feedback> to refine this analysis, or explain why you are rejecting Melvin's proposal.

  7. shawnborton commented on Apr 28, 2026

    @shawnborton
    Contributor

    @MelvinBot what PR caused this? Was this the cause: #87155 Or was it something else?

  8. 70 remaining items

  9. melvin-bot commented on May 4, 2026

    @melvin-bot

    @ZhenjaHorbach / @aimane-chnaif @mallenexpensify 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]

  10. melvin-bot commented on May 4, 2026

    @melvin-bot

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

  11. luacmartins commented on May 5, 2026

    @luacmartins
    Contributor

    @ZhenjaHorbach will be paid via the main issue #85260. We just need to pay @aimane-chnaif for the PR review.

  12. mallenexpensify commented on May 7, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor+: @aimane-chnaif due $250 via Upwork

    @aimane-chnaif can you please accept the job below? Please reply here and tag me once you have.
    https://www.upwork.com/jobs/~022052497671705880228

  13. added
    Daily
    and removed
    Daily
    on May 7, 2026
  14. aimane-chnaif commented on May 8, 2026

    @aimane-chnaif
    Contributor

    @mallenexpensify accepted offer

  15. melvin-bot commented on May 11, 2026

    @melvin-bot

    Payment Summary

    Upwork Job

    BugZero Checklist (@mallenexpensify)

    • (if NewFeature) I have created a PR for any necessary HelpDot updates, or I confirmed no updates are necessary.
    • I have verified the correct assignees and roles are listed above and updated the necessary manual offers
    • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants//hired)
    • I have verified the PR was not reverted
    • I have applied any discounts due to bugs/regressions introduced by this PR
    • I have paid out the Upwork contracts or cancelled the ones that are incorrect
    • I have verified the payment summary above is correct
  16. mallenexpensify commented on May 12, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor+: @aimane-chnaif due $250 via NewDot

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

Metadata

Metadata

Labels

Awaiting PaymentBugDailyEngineering

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions