You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
FAB - Create expense item is highlighted after opening Manual expense flow #90664
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.
Go to staging.new.expensify.com
Open FAB > Create expense.
Go to Manual tab.
Close the RHP.
Open FAB > Create expense.
Close the RHP.
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.
👋 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:
Identify the pull request that introduced this issue and revert it.
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.
The bug specifically involves the new Manual expense flow UI (IOURequestStepConfirmation rendered inline within IOURequestStartPage) introduced by this PR.
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:
startMoneyRequest is called with isFromFloatingActionButton: true, which sets this flag in the TRANSACTION_DRAFT Onyx key.
IOURequestStepConfirmation renders inline with focusable inputs inside the FocusTrap.
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).
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.
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), NavigationFocusReturnrestores 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?
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.
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:
User clicks "Create expense" → mouseActivationHandler captures the element as lastMouseTrigger
startMoneyRequest navigates forward to MONEY_REQUEST_CREATE route
handleStateChange detects forward nav, stores the Create expense element in triggerMap
onItemPress calls setFocusedIndex(-1) to reset FAB highlight
User closes RHP → handleStateChange detects backward nav, calls scheduleRestore
restoreTriggerForRoute calls .focus() on the captured Create expense element
Native focus event fires React onFocus on FABFocusableMenuItem → setFocusedIndex(0) (overwrites the -1 from step 4)
User reopens FAB → popover shows with focusedIndex=0 → "Create expense" has highlighted background
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.
@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!
Activity
melvin-bot commentedon May 14, 2026
You have been assigned to this deploy blocker because you recently merged this PR: #87920
melvin-bot commentedon May 14, 2026
💬 A slack conversation has been started in #expensify-open-source
github-actions commentedon May 14, 2026
👋 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:
OSBotify commentedon May 14, 2026
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
newManualExpenseFlowbeta), 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:
DeployBlockerCashkept (Frontend bug in App repo). No label changes made.📋 Detailed Analysis
Evidence
newManualExpenseFlowbeta is enabled — this is a new feature introduced by PR Feat: Manual expense flow UI refactor - r3 #87920.StagingDeployCashchecklist (item Rather than creating RegExp when triggering callbacks, create the RegExp when subscribing. #17 chronologically) and was merged on 2026-05-13, aligning with when the bug appeared.IOURequestStepConfirmationrendered inline withinIOURequestStartPage) introduced by this PR.Verification
src/pages/iou/request/IOURequestStartPage.tsx,src/pages/iou/request/step/IOURequestStepConfirmation.tsx,src/components/MoneyRequestConfirmationList.tsx,src/components/ParticipantPicker.tsxgh pr view 87920 --json files.CONST.BETAS.NEW_MANUAL_EXPENSE_FLOWbeta is active, which is exactly the feature gating added by this PR viaisBetaEnabled(CONST.BETAS.NEW_MANUAL_EXPENSE_FLOW)inIOURequestStartPage.Root Cause
PR #87920 changed the Manual tab in
IOURequestStartPageto renderIOURequestStepConfirmationinline (instead ofIOURequestStepAmountWithTransactionOnly). This is wrapped in aTabScreenWithFocusTrapWrapper, which interacts with theFABPopoverMenu's focus management.When the user opens the FAB, presses "Create expense", and navigates to the Manual tab:
startMoneyRequestis called withisFromFloatingActionButton: true, which sets this flag in theTRANSACTION_DRAFTOnyx key.IOURequestStepConfirmationrenders inline with focusable inputs inside theFocusTrap.OPTIMISTIC_TRANSACTION_IDdraft retains itsisFromFloatingActionButton: truestate (onlydraftTransactionIDsentries are nullified byclearMoneyRequest, not the optimistic transaction draft itself).onFocus={() => setFocusedIndex(itemIndex)}handler on theFABFocusableMenuItem), which highlights it. Because the new inline confirmation screen affects navigation/focus restoration, thefocusedIndexis not reset to-1as expected, leaving the item visually highlighted.The bug is staging-only and requires the
newManualExpenseFlowbeta to reproduce, confirming it was introduced by PR #87920.MelvinBot commentedon May 14, 2026
Proposal
What is the root cause of that problem?
When the user clicks "Create expense" in the FAB, the
NavigationFocusReturnsystem captures the clicked DOM element as a navigation trigger. When the RHP is later closed (backward navigation),NavigationFocusReturnrestores browser focus to that captured element by calling.focus()on it.This fires the
onFocushandler onFABFocusableMenuItem, which callssetFocusedIndex(itemIndex)— settingfocusedIndexto0(the "Create expense" item's index) even though the popover is hidden.When the user reopens the FAB,
focusedIndexis still0becauseuseArrowKeyFocusManageronly appliesinitialFocusedIndex: -1on first mount, andisActiveonly controls keyboard shortcuts — not the state value. The stalefocusedIndex=0causes the item to render withisFocused=trueand an active background color.What changes do you think we should make in order to solve the problem?
In
FABFocusableMenuItem.tsx, guard theonFocushandler so it only setsfocusedIndexwhen the FAB popover is actually visible. TheisVisibleprop from theFABMenuContextis already available in the component's context. Something like:Where
isVisiblecomes from theFABMenuContext(already provided byFABPopoverMenu). This prevents the stale focus restoration fromNavigationFocusReturnfrom settingfocusedIndexwhen the popover is hidden.What alternative solutions did you explore?
Reset
focusedIndexwhenisVisibletransitions totrueinFABPopoverMenu— adding auseEffectto callsetFocusedIndex(-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.Prevent
NavigationFocusReturnfrom 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:
mouseActivationHandlercaptures the element aslastMouseTriggerstartMoneyRequestnavigates forward toMONEY_REQUEST_CREATEroutehandleStateChangedetects forward nav, stores the Create expense element intriggerMaponItemPresscallssetFocusedIndex(-1)to reset FAB highlighthandleStateChangedetects backward nav, callsscheduleRestorerestoreTriggerForRoutecalls.focus()on the captured Create expense elementonFocusonFABFocusableMenuItem→setFocusedIndex(0)(overwrites the-1from step 4)focusedIndex=0→ "Create expense" has highlighted backgroundKey files:
NavigationFocusReturn.ts:358-366— captures/restores focus on navigationFABFocusableMenuItem.tsx:27—onFocussetsfocusedIndexFABPopoverMenu.tsx:72-76—initialFocusedIndexonly applies on mountuseFABMenuItem.ts:34-36—isFocuseddrives the visual highlightNext Steps for Contributor+ team: Reply with
@MelvinBot implement thisto create a draft PR,@MelvinBot <your feedback>to refine this analysis, or explain why you are rejecting Melvin's proposal.ChavdaSachin commentedon May 14, 2026
NAB: Only happens on beta accounts
puneetlath commentedon May 14, 2026
Demoting.
4 remaining items
melvin-bot commentedon May 19, 2026
@puneetlath, @ShridharGoel, @ChavdaSachin Eep! 4 days overdue now. Issues have feelings too...
melvin-bot commentedon May 21, 2026
@ChavdaSachin Still overdue 6 days?! Let's take care of this!
melvin-bot commentedon May 25, 2026
@ChavdaSachin 10 days overdue. Is anyone even seeing these? Hello?
dukenv0307 commentedon May 27, 2026
I can't reproduce
melvin-bot commentedon May 28, 2026
@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!
thelullabyy commentedon May 29, 2026
@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
jponikarchuk commentedon May 31, 2026
@thelullabyy This issue is not reproducible now
trjExpensify commentedon Jun 1, 2026
Okay great, closing!