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
[Due for payment 2026-09-09] [$250] Keyboard Navigation-Unable to focus the Back button by pressing Tab in the Manual tab #98709
Version Number: v9.4.54-1 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack:#97678 Email or phone of affected tester (no customers):applausetester+ag140826ec@applause.expensifail.com Issue reported by: Applause Internal Team Bug source: Pull Request QA execution Device used: Windows 11/ Chrome App Component: Other
Action Performed:
Precondition: Select the Manual tab before executing the steps. This ensures that the Manual tab is the one opened after step 5 instead of any other tab.
Go to staging.new.expensify.com
Open any chat
Press Tab until the + button next to the composer is focused
Press Enter to open the menu
Use ↓ to highlight Create expense, then press Enter
Press Tab until the Back button is focused
Expected Result:
The Back button can be focused.
Actual Result:
The Back button can't be focused.
The issue also occurs in the Split expense flow (Manual tab).
The Back button and the RHP header are correctly wired into the screen's focus trap — so this is not the obvious "header left out of the tab order" bug. The header is registered as a focus‑trap container in IOURequestStartPage.tsx:282-290, and the Back button renders as a normal tabindex="0"role="button" in HeaderWithBackButton/index.tsx:210-236.
The bug is specific to the Manual tab because it is the only tab that auto‑focuses a text input on entry (the amount keypad) in IOURequestStepAmount.tsx:164-177. With focus starting inside the amount input, focus-trap never advances Tab out to the header's container group — the most likely mechanism is that Tab escapes the trap's containers and focus-trap's "re-focus most‑recently‑focused node" fallback snaps focus back onto the amount input, so the Back button is never reached. This also explains why the same happens in the Split expense Manual tab (same IOURequestStartPage).
Back button is natively focusable:PressableWithoutFeedback with role="button" and no focusable={false}/tabIndex=-1; react-native-web renders it with tabindex="0".
Manual tab auto-focuses the amount input, which is what differentiates it from Scan/Distance. The focus-trap fallback that re-focuses the last focused node (when a Tab escapes all containers) matches the reported symptom of focus being "stuck" on the amount field.
⚠️Verification gap: I attempted a live browser DOM check to confirm exactly which container/tabbable drops out of the cycle, but the test session came up blank and I couldn't drive the app. So the precise focus-trap mechanism (escape → MRU re‑focus vs. a container failing to register at runtime) is a strong hypothesis, not a confirmed observation. The reproduction itself is confirmed by the reporter (staging + production).
What changes do you think we should make in order to solve the problem?
Confirm with a browser DOM inspection which focus-trap fallback fires, then fix accordingly. The most probable fix is one of:
Ensure the Manual tab's other interactive elements (currency selector, Next button) live inside the registered activeTabContainerElement and remain tabbable, so focus-trap's boundary redirect to the header group actually fires instead of falling back to re‑focusing the amount input; and/or
Set an explicit tab order / setReturnFocus/initialFocus so focus-trap does not snap focus back to the auto‑focused amount input on Tab.
The Back button and the header→trap wiring themselves should not be changed — they are correct.
What alternative solutions did you explore? (Optional)
Considered that the Back button was simply excluded from the tab order (tabIndex=-1/focusable={false}) — ruled out by the code above. Considered a general focus‑loss regression like the tracking issue #86699, but this reproduces deterministically only on the Manual tab, pointing at the amount‑input auto‑focus + focus‑trap interaction rather than a generic focus‑return bug.
Possibly related issues:#86699 (Accessibility focus tracking), #96972 (focus lost after Back in Expense & Chat flows).
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/98709) to create a draft PR. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
I don't think the Back button or the amount-field autofocus is the failing layer here. IOURequestStartPage already owns a focus trap whose containers include the outer header, tab bar, and active tab, but the Manual tab embeds IOURequestStepConfirmation inside that active-tab container with shouldHideHeader:
// When switching from the Scan or Per diem tab, the shared draft is briefly still a scan/per-diem request
// until the tab-switch reset rebuilds it as manual. Mounting the embedded confirmation against that stale
// draft does throwaway work that is immediately discarded once the reset lands - for scan a heavy first
// render (scan loader, reading the receipt blob), and for per diem the confirmation renders per-diem UI
// (wrong fields, and the "Confirm page shows per diem" bug). Wait for the reset so the manual confirmation
// mounts once against the rebuilt manual draft.
// The header and tab bar remain visible above this loader, so per UI-1 use ActivityIndicator (users can still go back) instead of FullScreenLoadingIndicator.
{/* If the new manual expense flow is enabled, the confirmation screen is shown on the start page, so we do not want to disable the drag and drop provider in that case */}
* When this screen is embedded on IOURequestStartPage (shouldHideHeader=true),
* skip MoneyRequestInitializer to avoid duplicate initialization and navigation side effects.
*/}
{!shouldHideHeader&&(
<MoneyRequestInitializer
isLoadingTransaction={!!isLoadingTransaction}
transaction={transaction}
. Every ScreenWrapper creates a FocusTrapForScreen, and both wrappers see the same focused route, so both traps become active on the shared trap stack. The later inner trap contains only the confirmation subtree, which excludes the outer Back button; that is why Tab stays inside Manual confirmation even though the Back button is correctly included in the outer trap. The Split/Manual repro follows the same embedded component path.
I would make the confirmation wrapper's trap inactive while it is embedded, for example by passing focusTrapSettings={{active: !shouldHideHeader}} to its ScreenWrapper, and leave the outer IOURequestStartPage trap as the sole owner of the combined header/tab/content cycle. Standalone confirmation routes would keep their existing trap, and the current header, autofocus, and tab-container wiring would remain unchanged. FocusTrapForScreen already supports an explicit active override before its route-focus fallback:
The regression test should render the embedded Manual path and assert that only the outer trap is active and Tab can reach the Back button from the confirmation content, then render IOURequestStepConfirmation as a standalone route and verify its own trap is still active. The same embedded assertion should cover Split/Manual. Changing tab order or autofocus would only mask the nested ownership problem and leave two active traps competing for the same route.
On the new manual expense flow, IOURequestStartPage embeds IOURequestStepConfirmation as the Manual tab body with shouldHideHeaderIOURequestStartPage.tsx#L255-L260. The page already builds one correct focus trap whose containers are the header (Back button), the tab bar and the active tab body IOURequestStartPage.tsx#L214-L216; with that trap alone, Tab reaches Back.
But IOURequestStepConfirmationalways renders its own ScreenWrapper, even when embedded IOURequestStepConfirmation.tsx#L862-L865, and every ScreenWrapper creates a FocusTrapForScreen. Its route manual is in TOP_TAB_SCREENS, so it activates when the tab is focused index.web.tsx#L33, and it passes no containerElements, so it traps only its own body index.web.tsx#L48. Both traps share sharedTrapStack; the confirmation's activates second (observed onActivate at stackLen: 1), sits on top and pauses the outer trap. Tab is then confined to the body — Amount → Merchant → Description → Category → Date → Create expense wraps back to the top of the body, never reaching Back.
The sibling proves it: the amount step on the same page uses StepScreenWrapper with shouldShowWrapper={!!backTo || isEditing}IOURequestStepAmount.tsx#L278, rendering no wrapper/trap when embedded StepScreenWrapper.tsx#L72 — so Back is reachable there. The confirmation is the only embedded body that mounts a competing trap, which is why Back can't be focused in the Manual tab (and the Split Manual tab, the same component).
What changes do you think we should make in order to solve the problem?
Disable the confirmation's own focus trap when it is embedded, so the single IOURequestStartPage trap — which already contains the header, the tab bar and the body — governs Tab. ScreenWrapper already forwards focusTrapSettings, and FocusTrapForScreen honors an explicit active, so no new plumbing is needed.
The constraint the confirmation's trap protects: it is required when the confirmation is a standalone screen (scan / edit / STEP_CONFIRMATION), where shouldHideHeader is false and it renders its own header + Back. Gating on shouldHideHeader keeps that path passing undefined, so it stays byte-for-byte unchanged — no regression. In embedded mode the outer trap already includes the confirmation body as its active-tab container element, so nothing loses trapping.
Blast radius is one line: shouldHideHeader is only ever true on this embedded path IOURequestStepConfirmation.tsx#L144, there is no new string / type / API, and focusTrapSettings is web-only (a no-op on native). The same one change fixes the Split Manual tab too, since it embeds the same IOURequestStepConfirmation.
Verified on web with the beta enabled: with the change the confirmation's manual trap reports isActive: false, and Tab now goes Merchant → … → Create expense → Back → Manual → Scan → body; the standalone confirmation, unchanged, still traps within its own header.
What alternative solutions did you explore? (Optional)
Add the parent header to the confirmation's own trap, or register the body as an extra container on it: wrong layer — the embedded confirmation shouldn't know about the parent's header, and the outer trap already covers the body via its active-tab container. Only the competing inner trap needs to stand down.
Skip the confirmation's ScreenWrapper entirely when embedded (mirroring StepScreenWrapper.shouldShowWrapper): fixes the trap but also drops the keyboard-avoiding / offline / layout wrappers the confirmation body relies on. Disabling just the focus trap via focusTrapSettings is minimal.
Deactivate the outer page trap instead: its container set is the one that actually holds the Back button and tabs, so keeping it and dropping the redundant inner trap is the correct direction.
Please re-state the problem that we are trying to solve in this issue.
In the Create Expense flow, after opening the Manual tab (or the Split Expense Manual tab), pressing Tab repeatedly can never move focus to the header's Back button. The Back button is visible but permanently unreachable via keyboard navigation.
What is the root cause of that problem?
IOURequestStartPage deliberately builds one shared, multi-container focus trap so keyboard Tab cycling includes the header, the tab bar, and the active tab's content together as a single loop (so Tab from the last field wraps back around to the header's Back button):
That array is passed down as focusTrapSettings.containerElements to the page's own ScreenWrapper, and the header is wrapped in a FocusTrapContainerElement so it becomes one of those containers:
{/* If the new manual expense flow is enabled, the confirmation screen is shown on the start page, so we do not want to disable the drag and drop provider in that case */}
For the Manual tab, this parent embeds IOURequestStepConfirmation directly (with shouldHideHeader to avoid a duplicate header) instead of using the gated StepScreenWrapper that Scan/Distance use:
IOURequestStepConfirmation unconditionally renders its own, separate <ScreenWrapper> with no focusTrapSettings at all — shouldHideHeader only skips rendering the visible inner <HeaderWithBackButton> a few hundred lines later, it does not affect the ScreenWrapper/focus-trap itself:
/** Skip focus of the first interactive element in the header to make sure that Enter key submits the expense on the confirmation page instead of navigating back. */
Every ScreenWrapper always wraps its children in FocusTrapForScreen, and when no containerElements are supplied it falls back to trapping only its own single wrapped DOM node:
So mounting the embedded confirmation creates a second, independentfocus-trap-react instance whose boundary is just the confirmation form — it never includes the outer header or tab bar.
Both trap instances push onto the same sharedTrapStack used across the app. focus-trap's activateTrap pauses (detaches the Tab/keydown listeners of) whatever trap was previously active on the stack whenever a new trap activates on top of it. Because the inner confirmation trap mounts after the outer IOURequestStartPage trap, it becomes the sole active trap, silently pausing the outer, header-inclusive trap. From then on, Tab only cycles within the confirmation form's own boundary and can never reach the Back button — no matter how many times Tab is pressed.
This explains why Scan and Distance don't reproduce it: those tabs render through StepScreenWrapper, which is explicitly gated with shouldShowWrapper so it skips creating its own ScreenWrapper/trap entirely when embedded fresh (no backTo, not editing):
With no nested ScreenWrapper mounted, no second trap ever activates, so the outer trap (with the header included) stays active and Tab correctly reaches the Back button. IOURequestStepConfirmation has no equivalent gate — shouldHideHeader only hides the visual header, leaving the trap-creating ScreenWrapper always mounted.
What changes do you think we should make in order to solve the problem?
Follow the exact pattern that already works for Scan/Distance: when IOURequestStepConfirmation is embedded (shouldHideHeader is true), it should not stand up its own ScreenWrapper/focus trap at all — it should render its content directly and let the parent IOURequestStartPage's already-correct, header-inclusive trap remain the sole active trap.
This is a minimal, targeted variant of the same gating already proven correct for Scan/Distance — it reuses the existing shouldHideHeader flag (no new prop needed) and doesn't touch focus-trap-react, sharedTrapStack, or any other shared infrastructure. An equally acceptable alternative that stays even closer to a one-line diff is passing focusTrapSettings={{active: false}} to this inner ScreenWrapper when shouldHideHeader is true, so it never activates a competing trap on sharedTrapStack, but skipping the wrapper entirely (as above) is preferable since it also avoids mounting a redundant FocusTrapForScreen/FocusTrap instance and any of ScreenWrapper's other side effects (safe-area handling, keyboard-avoiding view, etc.) for a screen that is purely embedded content.
Edge cases:
Standalone confirmation (RHP): shouldHideHeader defaults to false everywhere except IOURequestStartPage's Manual tab (confirmed via IOURequestStepConfirmation's only other callers, ModalStackNavigators and SubmitExpenseOrchestrator, neither of which pass it). So the standalone confirmation screen keeps its own ScreenWrapper and header exactly as before — unaffected.
Split Expense (Manual tab): Uses the same embedded-confirmation code path (shouldHideHeader), so the fix applies there too, resolving the issue's second reported case.
Tab switching (Scan/Per diem → Manual): While the shared transaction draft is being reset, manualTabContent renders the ActivityIndicator branch instead of IOURequestStepConfirmation, so no trap is mounted in that transient state either way — unaffected.
Offline / loading states: The change only affects which component owns the ScreenWrapper/focus-trap wrapper, not data fetching or rendering logic inside the confirmation form, so offline and loading behavior are unchanged.
Non-web platforms (iOS/Android app): focus-trap-react and FocusTrapForScreen's web-only trap logic (index.web.tsx) don't apply to native, so this fix is a no-op there; native focus/back-button handling (useAndroidBackButtonHandler) is untouched.
Existing callers of IOURequestStepConfirmation: Only the render wrapper changes conditionally on the existing shouldHideHeader prop; all children, props, and behavior of the confirmation form itself are preserved for both embedded and standalone modes.
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.4.68-1 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-09-09. 🎊
The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the Contributor+ 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]
[Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion: NA
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
Regression Test Proposal
Test:
Open any chat on web.
Press Tab until the + button next to the composer is focused.
Press Enter to open the menu.
Press ↓ to highlight Create expense, press Enter (Manual tab selected).
Press Tab repeatedly through the form.
Verify that the focus reaches the Back button and the Manual / Scan tabs, and the cycle wraps back into the form.
Repeat 1–6 with Split expense > Manual tab.
Open the standalone confirmation (e.g. Scan flow > confirmation) and verify that the tab still stays within that screen as before.
@abbasifaizan70 can you please accept the job below? Please reply here and tag me once you have.
If you're not sent an offer in Upwork when you're assigned to an issue, please tag me. If an Upwork job exists, please submit a proposal. https://www.upwork.com/jobs/~022088524457309099662
Activity
applause-bot commentedon Aug 15, 2026
While Applause doesn't embed attachments for this bug, here are the links for quick view:
https://platform.applause.com/services/links/v1/external/b36362239ebc12d41a97c9d26deecfd16c44abd7fa1efc7098a65ccf6edc75dd
j3ffffff commentedon Aug 15, 2026
MelvinBot commentedon Aug 15, 2026
Proposal
What is the root cause of that problem?
The Back button and the RHP header are correctly wired into the screen's focus trap — so this is not the obvious "header left out of the tab order" bug. The header is registered as a focus‑trap container in
IOURequestStartPage.tsx:282-290, and the Back button renders as a normaltabindex="0"role="button"inHeaderWithBackButton/index.tsx:210-236.The bug is specific to the Manual tab because it is the only tab that auto‑focuses a text input on entry (the amount keypad) in
IOURequestStepAmount.tsx:164-177. With focus starting inside the amount input,focus-trapnever advances Tab out to the header's container group — the most likely mechanism is that Tab escapes the trap's containers andfocus-trap's "re-focus most‑recently‑focused node" fallback snaps focus back onto the amount input, so the Back button is never reached. This also explains why the same happens in the Split expense Manual tab (sameIOURequestStartPage).Investigation details & evidence
IOURequestStartPagecollects[headerContainer, tabBarContainer, activeTabContainer](IOURequestStartPage.tsx:210-216) and passes them toScreenWrapper→FocusTrapForScreen/index.web.tsx:44-48→focus-trap-reactcontainerElements. The tabBar/activeTab containers are registered viaOnyxTabNavigator.tsxandTabSelector.tsx:66.PressableWithoutFeedbackwithrole="button"and nofocusable={false}/tabIndex=-1; react-native-web renders it withtabindex="0".focus-trapfallback that re-focuses the last focused node (when a Tab escapes all containers) matches the reported symptom of focus being "stuck" on the amount field.focus-trapmechanism (escape → MRU re‑focus vs. a container failing to register at runtime) is a strong hypothesis, not a confirmed observation. The reproduction itself is confirmed by the reporter (staging + production).What changes do you think we should make in order to solve the problem?
Confirm with a browser DOM inspection which
focus-trapfallback fires, then fix accordingly. The most probable fix is one of:activeTabContainerElementand remain tabbable, sofocus-trap's boundary redirect to the header group actually fires instead of falling back to re‑focusing the amount input; and/orsetReturnFocus/initialFocussofocus-trapdoes not snap focus back to the auto‑focused amount input on Tab.The Back button and the header→trap wiring themselves should not be changed — they are correct.
What alternative solutions did you explore? (Optional)
Considered that the Back button was simply excluded from the tab order (
tabIndex=-1/focusable={false}) — ruled out by the code above. Considered a general focus‑loss regression like the tracking issue #86699, but this reproduces deterministically only on the Manual tab, pointing at the amount‑input auto‑focus + focus‑trap interaction rather than a generic focus‑return bug.Possibly related issues: #86699 (Accessibility focus tracking), #96972 (focus lost after Back in Expense & Chat flows).
Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/98709)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
melvin-bot commentedon Aug 15, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @shubham1206agra (
External)melvin-bot commentedon Aug 15, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022088524457309099662
skrohan5016-coder commentedon Aug 15, 2026
I don't think the Back button or the amount-field autofocus is the failing layer here.
IOURequestStartPagealready owns a focus trap whose containers include the outer header, tab bar, and active tab, but the Manual tab embedsIOURequestStepConfirmationinside that active-tab container withshouldHideHeader:App/src/pages/iou/request/IOURequestStartPage.tsx
Lines 204 to 296 in a1f71ac
shouldHideHeaderskips the inner header and initializer, but it does not skip the innerScreenWrapper:App/src/pages/iou/request/step/IOURequestStepConfirmation.tsx
Lines 856 to 894 in a1f71ac
ScreenWrappercreates aFocusTrapForScreen, and both wrappers see the same focused route, so both traps become active on the shared trap stack. The later inner trap contains only the confirmation subtree, which excludes the outer Back button; that is why Tab stays inside Manual confirmation even though the Back button is correctly included in the outer trap. The Split/Manual repro follows the same embedded component path.I would make the confirmation wrapper's trap inactive while it is embedded, for example by passing
focusTrapSettings={{active: !shouldHideHeader}}to itsScreenWrapper, and leave the outerIOURequestStartPagetrap as the sole owner of the combined header/tab/content cycle. Standalone confirmation routes would keep their existing trap, and the current header, autofocus, and tab-container wiring would remain unchanged.FocusTrapForScreenalready supports an explicitactiveoverride before its route-focus fallback:App/src/components/FocusTrap/FocusTrapForScreen/index.web.tsx
Lines 17 to 44 in a1f71ac
The regression test should render the embedded Manual path and assert that only the outer trap is active and Tab can reach the Back button from the confirmation content, then render
IOURequestStepConfirmationas a standalone route and verify its own trap is still active. The same embedded assertion should cover Split/Manual. Changing tab order or autofocus would only mask the nested ownership problem and leave two active traps competing for the same route.shubham1206agra commentedon Aug 16, 2026
🆘 C+ Help Wanted
yusufdeveloper2903 commentedon Aug 16, 2026
Proposal
What is the root cause of that problem?
On the new manual expense flow,
IOURequestStartPageembedsIOURequestStepConfirmationas the Manual tab body withshouldHideHeaderIOURequestStartPage.tsx#L255-L260. The page already builds one correct focus trap whose containers are the header (Back button), the tab bar and the active tab body IOURequestStartPage.tsx#L214-L216; with that trap alone, Tab reaches Back.But
IOURequestStepConfirmationalways renders its ownScreenWrapper, even when embedded IOURequestStepConfirmation.tsx#L862-L865, and everyScreenWrappercreates aFocusTrapForScreen. Its routemanualis inTOP_TAB_SCREENS, so it activates when the tab is focused index.web.tsx#L33, and it passes nocontainerElements, so it traps only its own body index.web.tsx#L48. Both traps sharesharedTrapStack; the confirmation's activates second (observedonActivateatstackLen: 1), sits on top and pauses the outer trap. Tab is then confined to the body — Amount → Merchant → Description → Category → Date → Create expense wraps back to the top of the body, never reaching Back.The sibling proves it: the amount step on the same page uses
StepScreenWrapperwithshouldShowWrapper={!!backTo || isEditing}IOURequestStepAmount.tsx#L278, rendering no wrapper/trap when embedded StepScreenWrapper.tsx#L72 — so Back is reachable there. The confirmation is the only embedded body that mounts a competing trap, which is why Back can't be focused in the Manual tab (and the Split Manual tab, the same component).What changes do you think we should make in order to solve the problem?
Disable the confirmation's own focus trap when it is embedded, so the single
IOURequestStartPagetrap — which already contains the header, the tab bar and the body — governs Tab.ScreenWrapperalready forwardsfocusTrapSettings, andFocusTrapForScreenhonors an explicitactive, so no new plumbing is needed.On the confirmation's
ScreenWrapperIOURequestStepConfirmation.tsx#L862:The constraint the confirmation's trap protects: it is required when the confirmation is a standalone screen (scan / edit /
STEP_CONFIRMATION), whereshouldHideHeaderis false and it renders its own header + Back. Gating onshouldHideHeaderkeeps that path passingundefined, so it stays byte-for-byte unchanged — no regression. In embedded mode the outer trap already includes the confirmation body as its active-tab container element, so nothing loses trapping.Blast radius is one line:
shouldHideHeaderis only ever true on this embedded path IOURequestStepConfirmation.tsx#L144, there is no new string / type / API, andfocusTrapSettingsis web-only (a no-op on native). The same one change fixes the Split Manual tab too, since it embeds the sameIOURequestStepConfirmation.Verified on web with the beta enabled: with the change the confirmation's
manualtrap reportsisActive: false, and Tab now goes Merchant → … → Create expense → Back → Manual → Scan → body; the standalone confirmation, unchanged, still traps within its own header.What alternative solutions did you explore? (Optional)
ScreenWrapperentirely when embedded (mirroringStepScreenWrapper.shouldShowWrapper): fixes the trap but also drops the keyboard-avoiding / offline / layout wrappers the confirmation body relies on. Disabling just the focus trap viafocusTrapSettingsis minimal.abbasifaizan70 commentedon Aug 16, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
In the Create Expense flow, after opening the Manual tab (or the Split Expense Manual tab), pressing Tab repeatedly can never move focus to the header's Back button. The Back button is visible but permanently unreachable via keyboard navigation.
What is the root cause of that problem?
IOURequestStartPagedeliberately builds one shared, multi-container focus trap so keyboard Tab cycling includes the header, the tab bar, and the active tab's content together as a single loop (so Tab from the last field wraps back around to the header's Back button):App/src/pages/iou/request/IOURequestStartPage.tsx
Lines 210 to 216 in 1b5d844
That array is passed down as
focusTrapSettings.containerElementsto the page's ownScreenWrapper, and the header is wrapped in aFocusTrapContainerElementso it becomes one of those containers:App/src/pages/iou/request/IOURequestStartPage.tsx
Lines 272 to 290 in 1b5d844
For the Manual tab, this parent embeds
IOURequestStepConfirmationdirectly (withshouldHideHeaderto avoid a duplicate header) instead of using the gatedStepScreenWrapperthat Scan/Distance use:App/src/pages/iou/request/IOURequestStartPage.tsx
Lines 255 to 261 in 1b5d844
IOURequestStepConfirmationunconditionally renders its own, separate<ScreenWrapper>with nofocusTrapSettingsat all —shouldHideHeaderonly skips rendering the visible inner<HeaderWithBackButton>a few hundred lines later, it does not affect theScreenWrapper/focus-trap itself:App/src/pages/iou/request/step/IOURequestStepConfirmation.tsx
Lines 862 to 866 in 1b5d844
App/src/pages/iou/request/step/IOURequestStepConfirmation.tsx
Lines 930 to 947 in 1b5d844
Every
ScreenWrapperalways wraps its children inFocusTrapForScreen, and when nocontainerElementsare supplied it falls back to trapping only its own single wrapped DOM node:App/src/components/FocusTrap/FocusTrapForScreen/index.web.tsx
Lines 44 to 48 in 1b5d844
So mounting the embedded confirmation creates a second, independent
focus-trap-reactinstance whose boundary is just the confirmation form — it never includes the outer header or tab bar.Both trap instances push onto the same
sharedTrapStackused across the app.focus-trap'sactivateTrappauses (detaches the Tab/keydown listeners of) whatever trap was previously active on the stack whenever a new trap activates on top of it. Because the inner confirmation trap mounts after the outerIOURequestStartPagetrap, it becomes the sole active trap, silently pausing the outer, header-inclusive trap. From then on, Tab only cycles within the confirmation form's own boundary and can never reach the Back button — no matter how many times Tab is pressed.This explains why Scan and Distance don't reproduce it: those tabs render through
StepScreenWrapper, which is explicitly gated withshouldShowWrapperso it skips creating its ownScreenWrapper/trap entirely when embedded fresh (nobackTo, not editing):App/src/pages/iou/request/step/StepScreenWrapper.tsx
Lines 72 to 74 in 1b5d844
App/src/pages/iou/request/step/IOURequestStepAmount.tsx
Line 278 in 1b5d844
App/src/pages/iou/request/step/IOURequestStepDistance.tsx
Line 884 in 1b5d844
With no nested
ScreenWrappermounted, no second trap ever activates, so the outer trap (with the header included) stays active and Tab correctly reaches the Back button.IOURequestStepConfirmationhas no equivalent gate —shouldHideHeaderonly hides the visual header, leaving the trap-creatingScreenWrapperalways mounted.What changes do you think we should make in order to solve the problem?
Follow the exact pattern that already works for Scan/Distance: when
IOURequestStepConfirmationis embedded (shouldHideHeaderistrue), it should not stand up its ownScreenWrapper/focus trap at all — it should render its content directly and let the parentIOURequestStartPage's already-correct, header-inclusive trap remain the sole active trap.Original code:
App/src/pages/iou/request/step/IOURequestStepConfirmation.tsx
Lines 862 to 866 in 1b5d844
Change the
IOURequestStepConfirmationrender to conditionally skip the wrapper when embedded, mirroringStepScreenWrapper'sshouldShowWrappergate:This is a minimal, targeted variant of the same gating already proven correct for Scan/Distance — it reuses the existing
shouldHideHeaderflag (no new prop needed) and doesn't touchfocus-trap-react,sharedTrapStack, or any other shared infrastructure. An equally acceptable alternative that stays even closer to a one-line diff is passingfocusTrapSettings={{active: false}}to this innerScreenWrapperwhenshouldHideHeaderis true, so it never activates a competing trap onsharedTrapStack, but skipping the wrapper entirely (as above) is preferable since it also avoids mounting a redundantFocusTrapForScreen/FocusTrapinstance and any ofScreenWrapper's other side effects (safe-area handling, keyboard-avoiding view, etc.) for a screen that is purely embedded content.Edge cases:
shouldHideHeaderdefaults tofalseeverywhere exceptIOURequestStartPage's Manual tab (confirmed viaIOURequestStepConfirmation's only other callers,ModalStackNavigatorsandSubmitExpenseOrchestrator, neither of which pass it). So the standalone confirmation screen keeps its ownScreenWrapperand header exactly as before — unaffected.shouldHideHeader), so the fix applies there too, resolving the issue's second reported case.manualTabContentrenders theActivityIndicatorbranch instead ofIOURequestStepConfirmation, so no trap is mounted in that transient state either way — unaffected.ScreenWrapper/focus-trap wrapper, not data fetching or rendering logic inside the confirmation form, so offline and loading behavior are unchanged.focus-trap-reactandFocusTrapForScreen's web-only trap logic (index.web.tsx) don't apply to native, so this fix is a no-op there; native focus/back-button handling (useAndroidBackButtonHandler) is untouched.IOURequestStepConfirmation: Only the render wrapper changes conditionally on the existingshouldHideHeaderprop; all children, props, and behavior of the confirmation form itself are preserved for both embedded and standalone modes.49 remaining items
melvin-bot commentedon Sep 2, 2026
@shubham1206agra
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.4.68-1 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-09-09. 🎊
The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the Contributor+ 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]
melvin-bot commentedon Sep 7, 2026
@shubham1206agra Eep! 4 days overdue now. Issues have feelings too...
melvin-bot commentedon Sep 8, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)melvin-bot commentedon Sep 8, 2026
Payment Summary
Resolving PRs:
Upwork Job
BugZero Checklist (@mallenexpensify)
shubham1206agra commentedon Sep 9, 2026
Contributor+ Checklist:
[Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to the comment on the PR: https://github.com/Expensify/App/pull/87920/changes#r3971376238
Link to the comment on the Issue: [Due for payment 2026-08-12] Replace push rows with inline text inputs in manual expense create/edit flow #82586 (comment)
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion: NA
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
Regression Test Proposal
Test:
Do we agree 👍 or 👎
mallenexpensify commentedon Sep 10, 2026
Payment Summary
Contributor: @abbasifaizan70 paid $250 via Upwork
Contributor+: @shubham1206agra due $250 via NewDot
@abbasifaizan70 can you please accept the job below? Please reply here and tag me once you have.
If you're not sent an offer in Upwork when you're assigned to an issue, please tag me. If an Upwork job exists, please submit a proposal.
https://www.upwork.com/jobs/~022088524457309099662
abbasifaizan70 commentedon Sep 10, 2026
@mallenexpensify Offer accepted and submitted for payment. Thanks.
mallenexpensify commentedon Sep 10, 2026
@abbasifaizan70 paid, summary updated above. Thx.