Skip to content

FAB - Create expense item is highlighted after opening Manual expense flow #90664

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.74-0
Reproducible in staging?: Yes
Reproducible in production?: N/A - new feature, doesn't exist in prod
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #87920
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:

Precondition:

  • Run Onyx.merge('betas', ['newManualExpenseFlow']); in console.
  1. Go to staging.new.expensify.com
  2. Open FAB > Create expense.
  3. Go to Manual tab.
  4. Close the RHP.
  5. Open FAB > Create expense.
  6. Close the RHP.
  7. Open FAB.

Expected Result:

Create expense item will not be highlighted after opening Manual expense flow.

Actual Result:

Create expense item is highlighted after opening Manual expense flow.

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: @thelullabyy

Activity

  1. added
    DeployBlockerCash
    Bug
    on May 14, 2026
  2. melvin-bot commented on May 14, 2026

    @melvin-bot

    You have been assigned to this deploy blocker because you recently merged this PR: #87920

  3. melvin-bot commented on May 14, 2026

    @melvin-bot

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

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

    @OSBotify
    Contributor

    Investigation Summary

    Classification: Frontend bug
    Causing PR: #87920 - "Feat: Manual expense flow UI refactor - r3" by @ChavdaSachin (High confidence)
    Related Issues: #82586 (original issue this PR fixed)

    Recommendation: REVERT

    PR #87920 introduced the new Manual expense flow UI refactor (under the newManualExpenseFlow beta), and the melvin-bot also identified this as the causing PR. The bug is staging-only (new feature, not in production), so reverting is the cleanest path to unblock the deploy.

    Assigned: @ChavdaSachin (PR author), @ShridharGoel and @puneetlath (approving reviewers) from PR #87920
    Labels: DeployBlockerCash kept (Frontend bug in App repo). No label changes made.

    📋 Detailed Analysis

    Evidence

    Verification

    • Affected files: src/pages/iou/request/IOURequestStartPage.tsx, src/pages/iou/request/step/IOURequestStepConfirmation.tsx, src/components/MoneyRequestConfirmationList.tsx, src/components/ParticipantPicker.tsx
    • PR Feat: Manual expense flow UI refactor - r3 #87920 directly modifies all of these files. Confirmed via gh pr view 87920 --json files.
    • The bug only manifests when CONST.BETAS.NEW_MANUAL_EXPENSE_FLOW beta is active, which is exactly the feature gating added by this PR via isBetaEnabled(CONST.BETAS.NEW_MANUAL_EXPENSE_FLOW) in IOURequestStartPage.

    Root Cause

    PR #87920 changed the Manual tab in IOURequestStartPage to render IOURequestStepConfirmation inline (instead of IOURequestStepAmountWithTransactionOnly). This is wrapped in a TabScreenWithFocusTrapWrapper, which interacts with the FABPopoverMenu's focus management.

    When the user opens the FAB, presses "Create expense", and navigates to the Manual tab:

    1. startMoneyRequest is called with isFromFloatingActionButton: true, which sets this flag in the TRANSACTION_DRAFT Onyx key.
    2. IOURequestStepConfirmation renders inline with focusable inputs inside the FocusTrap.
    3. When the RHP is closed, the transaction draft is not fully cleared — the OPTIMISTIC_TRANSACTION_ID draft retains its isFromFloatingActionButton: true state (only draftTransactionIDs entries are nullified by clearMoneyRequest, not the optimistic transaction draft itself).
    4. On the second FAB open, the "Create expense" item receives focus (via the onFocus={() => setFocusedIndex(itemIndex)} handler on the FABFocusableMenuItem), which highlights it. Because the new inline confirmation screen affects navigation/focus restoration, the focusedIndex is not reset to -1 as expected, leaving the item visually highlighted.

    The bug is staging-only and requires the newManualExpenseFlow beta to reproduce, confirming it was introduced by PR #87920.

  6. MelvinBot commented on May 14, 2026

    @MelvinBot
    Contributor

    Proposal

    What is the root cause of that problem?

    When the user clicks "Create expense" in the FAB, the NavigationFocusReturn system captures the clicked DOM element as a navigation trigger. When the RHP is later closed (backward navigation), NavigationFocusReturn restores browser focus to that captured element by calling .focus() on it.

    This fires the onFocus handler on FABFocusableMenuItem, which calls setFocusedIndex(itemIndex) — setting focusedIndex to 0 (the "Create expense" item's index) even though the popover is hidden.

    When the user reopens the FAB, focusedIndex is still 0 because useArrowKeyFocusManager only applies initialFocusedIndex: -1 on first mount, and isActive only controls keyboard shortcuts — not the state value. The stale focusedIndex=0 causes the item to render with isFocused=true and an active background color.

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

    In FABFocusableMenuItem.tsx, guard the onFocus handler so it only sets focusedIndex when the FAB popover is actually visible. The isVisible prop from the FABMenuContext is already available in the component's context. Something like:

    onFocus={() => { if (isVisible) setFocusedIndex(itemIndex); }}
    

    Where isVisible comes from the FABMenuContext (already provided by FABPopoverMenu). This prevents the stale focus restoration from NavigationFocusReturn from setting focusedIndex when the popover is hidden.

    What alternative solutions did you explore?

    1. Reset focusedIndex when isVisible transitions to true in FABPopoverMenu — adding a useEffect to call setFocusedIndex(-1) when the popover opens. This would work but is less targeted; it would also clear focus set by keyboard navigation if the popover re-renders.

    2. Prevent NavigationFocusReturn from restoring focus to elements inside hidden popovers — this is a deeper change to the navigation focus system with a wider blast radius.

    Investigation details

    Data flow:

    1. User clicks "Create expense" → mouseActivationHandler captures the element as lastMouseTrigger
    2. startMoneyRequest navigates forward to MONEY_REQUEST_CREATE route
    3. handleStateChange detects forward nav, stores the Create expense element in triggerMap
    4. onItemPress calls setFocusedIndex(-1) to reset FAB highlight
    5. User closes RHP → handleStateChange detects backward nav, calls scheduleRestore
    6. restoreTriggerForRoute calls .focus() on the captured Create expense element
    7. Native focus event fires React onFocus on FABFocusableMenuItem → setFocusedIndex(0) (overwrites the -1 from step 4)
    8. User reopens FAB → popover shows with focusedIndex=0 → "Create expense" has highlighted background

    Key files:


    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. ChavdaSachin commented on May 14, 2026

    @ChavdaSachin
    Contributor

    NAB: Only happens on beta accounts

  8. puneetlath commented on May 14, 2026

    @puneetlath
    Contributor

    Demoting.

  9. 4 remaining items

  10. melvin-bot commented on May 19, 2026

    @melvin-bot

    @puneetlath, @ShridharGoel, @ChavdaSachin Eep! 4 days overdue now. Issues have feelings too...

  11. melvin-bot commented on May 21, 2026

    @melvin-bot

    @ChavdaSachin Still overdue 6 days?! Let's take care of this!

  12. melvin-bot commented on May 25, 2026

    @melvin-bot

    @ChavdaSachin 10 days overdue. Is anyone even seeing these? Hello?

  13. dukenv0307 commented on May 27, 2026

    @dukenv0307
    Contributor

    I can't reproduce

  14. melvin-bot commented on May 28, 2026

    @melvin-bot

    @puneetlath @ShridharGoel @ChavdaSachin @thelullabyy this issue was created 2 weeks ago. Are we close to a solution? Let's make sure we're treating this as a top priority. Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

  15. thelullabyy commented on May 29, 2026

    @thelullabyy
    Contributor

    @jponikarchuk Could you please re-verify this bug to see if it is still reproducible? I couldn't reproduce it as well

    Screen.Recording.2026-05-29.at.12.34.02.mov
  16. jponikarchuk commented on May 31, 2026

    @jponikarchuk
    Author

    @thelullabyy This issue is not reproducible now

  17. trjExpensify commented on Jun 1, 2026

    @trjExpensify
    Contributor

    Okay great, closing!

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

Metadata

Metadata

Labels

BugDailyEngineering

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions