Skip to content

[Due for payment 2026-08-25] Android & iOS - App crashes after interacting with pop-up modal #98691

Closed

Description

@applause-bot

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


Version Number: 9.4.54-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: -
Email or phone of affected tester (no customers): sdsiodjnosdjiodsj@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: iPhone 15 Pro Max / iOS 26.5.2
App Component: Money Requests

Action Performed:

  1. Launch Expensify app.
  2. Go to workspace settings > Categories.
  3. Open any category.
  4. Tap Delete category.
  5. Tap Delete.

Expected Result:

App will not crash.

Actual Result:

App crashes after interacting with pop-up modal.

This issue happens with any pop-up modal

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

https://platform.applause.com/services/links/v1/external/3f89f85e807eec8080782523b3b97f9bb86d724970885d851e04ad6fbada03a4

Bug7233917_1786739841491.ScreenRecording_08-15-2026_04-36-09_1.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Mita Rachim
Bug ID: 7233917

Issue OwnerCurrent Issue Owner: @Krishna2323

Activity

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

    @melvin-bot

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

  3. melvin-bot commented on Aug 14, 2026

    @melvin-bot

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

  4. github-actions commented on Aug 14, 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. MelvinBot commented on Aug 14, 2026

    @MelvinBot
    Contributor

    🔍 Investigation Summary

    Classification: Frontend bug
    Causing PR: #97678 - "Fix keyboard focus not returning to FAB and composer + after Back" by @Krishna2323 (High confidence)
    Related Issues: None

    Recommendation: ROLL FORWARD

    The crash is caused by a single unguarded block that references the web-only globals HTMLElement and document in a shared (non-.web) modal file, so it throws on native the moment any modal closes. A one-line platform guard is far smaller and safer than reverting a 14-file focus-management PR, and a revert would reintroduce the focus-return bug #97678 fixed. A clean revert is an acceptable fallback if a quick guard cannot be landed.

    Assigned: @Krishna2323 (PR author), @JS00001 and @mkhutornyi (approving reviewers) from the highest-confidence causing PR
    Labels: No change. This is a Frontend bug (App PR must be fixed/reverted), so DeployBlockerCash stays. DeployBlocker was not present. The App deploy remains blocked.

    📋 Detailed Analysis

    Evidence

    • Symptom profile matches a native-only regression exactly: crashes on Android App + iOS App only (not mWeb/web), reproduces on staging but not production, and happens with any pop-up modal — pointing at the shared modal close path rather than the Categories feature itself.
    • Comparing production...staging for the 9.4.54-0 release, the only shared modal-rendering change with a native-hostile diff is in src/components/Modal/ReanimatedModal/index.tsx.
    • The introducing commit 8104136 ("Blur only focus inside the closing modal instead of tracking the trap's focus return") is part of PR Fix keyboard focus not returning to FAB and composer + after Back #97678, merged 2026-08-14 — the same day this blocker was filed.

    Verification

    • Affected file: src/components/Modal/ReanimatedModal/index.tsx, which BaseModal.tsx renders unconditionally for every modal on all platforms.
    • Confirmed PR Fix keyboard focus not returning to FAB and composer + after Back #97678 modifies this file (gh api .../commits/8104136 shows the exact + if (container instanceof HTMLElement && container.contains(document.activeElement)) hunk).
    • The crash fires in the modal-close branch (!isVisible && isContainerOpen && !isTransitioning), i.e. "after interacting with a pop-up modal" — tapping Delete closes the confirm modal and triggers the throw.

    Root Cause

    PR #97678 replaced an unconditional blurActiveElement() call with a guarded version:

    const container = containerRef.current;
    if (container instanceof HTMLElement && container.contains(document.activeElement)) {
        blurActiveElement();
    }

    HTMLElement and document are web-only DOM globals. On native (Hermes) HTMLElement is not a defined variable, so evaluating container instanceof HTMLElement throws ReferenceError: Can't find variable: HTMLElement and crashes the app whenever a modal closes. The same file already demonstrates the correct approach a few lines above (L98–L112), where document access is gated behind getPlatform() === CONST.PLATFORM.WEB. The fix is to gate this new block the same way (or typeof HTMLElement !== 'undefined'), or move it into a .web variant.

    Offending code: ReanimatedModal/index.tsx#L147-L153

    💡 Suggested AI code review rule

    This bug looks like a recurring, mechanically detectable pattern, so it may be worth a coding-standards rule so the AI reviewer catches the next one. Proposed for Expensify/App:

    • Rule: CONSISTENCY-18 No web-only DOM globals in shared native code
    • Condition: Flag references to web-only globals (HTMLElement, document, window, navigator, instanceof HTMLElement) in a file that is not *.web.ts(x) unless the access is behind a platform guard (getPlatform() === CONST.PLATFORM.WEB / Platform.OS === 'web'). Guard it, or move the logic into a .web variant.
    • Why: These globals are undefined on native (Hermes); evaluating them throws ReferenceError and crashes the app. Here it crashed on close of every modal (#98691, PR #97678).
    • Search pattern: grep -rnE '\b(HTMLElement|document|window|navigator)\b' src --include='*.tsx' --include='*.ts' | grep -v '\.web\.' then check each hit is inside a WEB platform guard.
    • Offending code (❌): ReanimatedModal/index.tsx#L147-L153
    • Correct pattern (✅): same file, L98-L112 (DOM access gated behind getPlatform() === CONST.PLATFORM.WEB)

    This is distinct from CONSISTENCY-1 (which targets platform-branch maintainability, not native crashes from web-only globals). The full rule file, with ❌/✅ code inline in App's coding-standards format, would go in Expensify/App itself; a maintainer can open it there as a draft PR if it's worth adding.

  6. m-natarajan commented on Aug 15, 2026

    @m-natarajan

    Honor x6b / Android 16 and iPhone
    Not Repro
    9.4.54-1

    document_4900429084825224967.mp4
    ScreenRecording_08-15-2026.06-16-15_1.MP4
  7. m-natarajan commented on Aug 15, 2026

    @m-natarajan

    Issue fixed and closing as per this comment

  8. melvin-bot commented on Aug 18, 2026

    @melvin-bot

    @Krishna2323 / @mkhutornyi

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.4.54-4 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 2026-08-25. 🎊

    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]. If no checklist is needed for this issue, you can click: [no checklist button]

  9. changed the title [-]Android & iOS - App crashes after interacting with pop-up modal[/-] [+][Due for payment 2026-08-25] Android & iOS - App crashes after interacting with pop-up modal[/+] on Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2Engineering

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions