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
IOU - Pressing Enter after pressing Enter on Merchant opens Merchant instead of creating expense #85866
Version Number: 9.3.41-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:#79834 Email or phone of affected tester (no customers):sijnisojnsiojdosjjo2@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
👋 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.
Please re-state the problem that we are trying to solve in this issue.
On the expense confirmation page, after editing the Merchant field and pressing Enter to save, pressing Enter again opens the Merchant page instead of creating the expense. This works correctly in production but is broken in staging after PR #79834 was merged.
What is the root cause of that problem?
PR #79834 introduced a focus restoration mechanism for back navigation. When the user clicks the Merchant MenuItem to edit it, NavigationFocusManager captures that element for the confirmation route. When navigating back from the Merchant page, FocusTrapForScreen restores focus to the Merchant MenuItem after a ~300ms delay (delayInitialFocus: CONST.ANIMATED_TRANSITION).
This causes two compounding problems:
The confirm button's Enter shortcut gets deactivated.ButtonWithDropdownMenu uses pressOnEnter which registers a global Enter keyboard shortcut. However, Button's KeyboardShortcutComponent (src/components/Button/index.tsx:194-232) has a shouldDisableEnterShortcut check that disables the shortcut when any element with an accessibility role (other than presentation) has focus. Since the Merchant MenuItem has role='button', the confirm button's Enter shortcut is disabled.
The browser activates the focused MenuItem instead. When Enter is pressed on a focused role='button' element, the browser fires a native synthetic click event. React Native Web's PressResponder translates this to onPress, which navigates to the Merchant page again.
What changes do you think we should make in order to solve the problem?
The fix should prevent focus restoration from restoring focus to the element that triggered the navigation away from the screen. When the user clicks the Merchant MenuItem to navigate to the Merchant edit page, restoring focus to that same MenuItem on back-navigation is counterproductive — the user has already completed that interaction.
In FocusTrapForScreen's initialFocus callback, add a check: if the captured element is a non-input interactive element (e.g., role='button' MenuItem) that triggered the navigation, return false instead of restoring focus to it. This allows the confirm button's Enter shortcut to remain active, and pressing Enter will submit the expense as expected.
Alternatively, in NavigationFocusManager, skip capturing the element when the interaction (click/Enter) triggers navigation (i.e., when the element's press handler navigates to a new screen). This could be done by clearing the capture in a microtask if navigation occurred.
What alternative solutions did you explore? (Optional)
Modifying shouldDisableEnterShortcut in Button to not disable when the focused element is a MenuItem on the confirmation page — too specific, doesn't fix the general problem.
Setting tabIndex={-1} on MenuItems in the confirmation list — would break keyboard accessibility for those fields.
Adding an onKeyDown handler to MenuItem that prevents Enter activation after focus restoration — fragile timing-based solution.
Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot to refine this analysis, or explain why you are rejecting Melvin's proposal.
this would be the expected result, but looks like in some special cases like this one - we might want to keep the focus on the Create expense button as opposed to back on the Merchant - but this would misalign accesibility behaviour for this case when it comes to all other cases in the app.
So for somebody that's used to this focus restoration mechanism, if we change it specifically for this issue, it would break that behaviour that the user is used to for all other cases in the app.
I'm thinking maybe we could have a split for cases where there's a form with multiple fields and a submit button, for which we would always return back and focus the submit button instead of the field from which we came back from ? 🤔
@Expensify/design What's your take on this ? ☝️ This suggestion I made in the paragraph above seems broken to me, given for all other cases where we don't have a submit button, we focus back on the field from which we came back.
Activity
melvin-bot commentedon Mar 19, 2026
You have been assigned to this deploy blocker because you recently merged this PR: #79834
melvin-bot commentedon Mar 19, 2026
💬 A slack conversation has been started in #expensify-open-source
github-actions commentedon Mar 19, 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:
MelvinBot commentedon Mar 19, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
On the expense confirmation page, after editing the Merchant field and pressing Enter to save, pressing Enter again opens the Merchant page instead of creating the expense. This works correctly in production but is broken in staging after PR #79834 was merged.
What is the root cause of that problem?
PR #79834 introduced a focus restoration mechanism for back navigation. When the user clicks the Merchant MenuItem to edit it,
NavigationFocusManagercaptures that element for the confirmation route. When navigating back from the Merchant page,FocusTrapForScreenrestores focus to the Merchant MenuItem after a ~300ms delay (delayInitialFocus: CONST.ANIMATED_TRANSITION).This causes two compounding problems:
The confirm button's Enter shortcut gets deactivated.
ButtonWithDropdownMenuusespressOnEnterwhich registers a global Enter keyboard shortcut. However,Button'sKeyboardShortcutComponent(src/components/Button/index.tsx:194-232) has ashouldDisableEnterShortcutcheck that disables the shortcut when any element with an accessibility role (other thanpresentation) has focus. Since the Merchant MenuItem hasrole='button', the confirm button's Enter shortcut is disabled.The browser activates the focused MenuItem instead. When Enter is pressed on a focused
role='button'element, the browser fires a native synthetic click event. React Native Web'sPressRespondertranslates this toonPress, which navigates to the Merchant page again.The key code path:
NavigationFocusManagercaptures the Merchant MenuItem on pointerdown/keydown (capture phase) atsrc/libs/NavigationFocusManager/index.web.tsFocusTrapForScreenrestores it viainitialFocuscallback atsrc/components/FocusTrap/FocusTrapForScreen/index.web.tsx:175-198blurActiveInputElementonly blurs INPUT/TEXTAREA elements, notrole='button'elements, so the restored focus persists atsrc/libs/Accessibility/blurActiveInputElement/index.ts:5-17What changes do you think we should make in order to solve the problem?
The fix should prevent focus restoration from restoring focus to the element that triggered the navigation away from the screen. When the user clicks the Merchant MenuItem to navigate to the Merchant edit page, restoring focus to that same MenuItem on back-navigation is counterproductive — the user has already completed that interaction.
In
FocusTrapForScreen'sinitialFocuscallback, add a check: if the captured element is a non-input interactive element (e.g.,role='button'MenuItem) that triggered the navigation, returnfalseinstead of restoring focus to it. This allows the confirm button's Enter shortcut to remain active, and pressing Enter will submit the expense as expected.Alternatively, in
NavigationFocusManager, skip capturing the element when the interaction (click/Enter) triggers navigation (i.e., when the element's press handler navigates to a new screen). This could be done by clearing the capture in a microtask if navigation occurred.What alternative solutions did you explore? (Optional)
shouldDisableEnterShortcutin Button to not disable when the focused element is a MenuItem on the confirmation page — too specific, doesn't fix the general problem.tabIndex={-1}on MenuItems in the confirmation list — would break keyboard accessibility for those fields.onKeyDownhandler to MenuItem that prevents Enter activation after focus restoration — fragile timing-based solution.Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot to refine this analysis, or explain why you are rejecting Melvin's proposal.
ikevin127 commentedon Mar 19, 2026
@MonilBhavsar Well, from the perspective of the accesibility PR:
this would be the expected result, but looks like in some special cases like this one - we might want to keep the focus on the Create expense button as opposed to back on the Merchant - but this would misalign accesibility behaviour for this case when it comes to all other cases in the app.
So for somebody that's used to this focus restoration mechanism, if we change it specifically for this issue, it would break that behaviour that the user is used to for all other cases in the app.
I'm thinking maybe we could have a split for cases where there's a form with multiple fields and a submit button, for which we would always return back and focus the submit button instead of the field from which we came back from ? 🤔
@Expensify/design What's your take on this ? ☝️ This suggestion I made in the paragraph above seems broken to me, given for all other cases where we don't have a submit button, we focus back on the field from which we came back.
melvin-bot commentedon Mar 19, 2026
If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.
If a regression has occurred and you are the assigned CM follow the instructions here.
If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.
MonilBhavsar commentedon Mar 20, 2026
Yeah, It doesn't appear like bug a to me. But curious about Design team's thoughts
melvin-bot commentedon Mar 20, 2026
If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.
If a regression has occurred and you are the assigned CM follow the instructions here.
If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.
IuliiaHerets commentedon Mar 20, 2026
Not reproduced on Windows 10/Chrome/Build v9.3.41-2
2026-03-20.12-15-41.mp4
cristipaval commentedon Mar 20, 2026
Thanks, closing
melvin-bot commentedon Mar 24, 2026
If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.
If a regression has occurred and you are the assigned CM follow the instructions here.
If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.