-
Notifications
You must be signed in to change notification settings - Fork 3.9k
InteractionManager migration - MoneyRequestConfirmationList, useDialogContainerFocus, useAutoFocusInput #92057
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
a5336b6
8bcb53d
7208654
f2fbdcd
1e4df07
538aca0
3e76e51
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,6 @@ | ||
| import {useFocusEffect, useIsFocused} from '@react-navigation/native'; | ||
| import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react'; | ||
| // eslint-disable-next-line no-restricted-imports | ||
| import {InteractionManager, View} from 'react-native'; | ||
| import {useIsFocused} from '@react-navigation/native'; | ||
| import React, {useCallback, useEffect, useMemo, useState} from 'react'; | ||
| import {View} from 'react-native'; | ||
| import type {OnyxEntry} from 'react-native-onyx'; | ||
| import useAttendees from '@hooks/useAttendees'; | ||
| import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails'; | ||
|
|
@@ -14,7 +13,6 @@ import usePolicyForTransaction from '@hooks/usePolicyForTransaction'; | |
| import usePreferredPolicy from '@hooks/usePreferredPolicy'; | ||
| import usePrevious from '@hooks/usePrevious'; | ||
| import useThemeStyles from '@hooks/useThemeStyles'; | ||
| import blurActiveElement from '@libs/Accessibility/blurActiveElement'; | ||
| import {isCategoryDescriptionRequired} from '@libs/CategoryUtils'; | ||
| import {isMovingTransactionFromTrackExpense as isMovingTransactionFromTrackExpenseUtil} from '@libs/IOUUtils'; | ||
| import Navigation from '@libs/Navigation/Navigation'; | ||
|
|
@@ -485,22 +483,6 @@ function MoneyRequestConfirmationList({ | |
| onSendMoney, | ||
| }); | ||
|
|
||
| const focusTimeoutRef = useRef<NodeJS.Timeout | null>(null); | ||
| useFocusEffect( | ||
| useCallback(() => { | ||
| // Blurring the active element after transition fights AmountField focus in the new manual flow (RHP reopen). | ||
| if (isNewManualExpenseFlowEnabled) { | ||
| return undefined; | ||
| } | ||
| focusTimeoutRef.current = setTimeout(() => { | ||
| InteractionManager.runAfterInteractions(() => { | ||
| blurActiveElement(); | ||
| }); | ||
| }, CONST.ANIMATED_TRANSITION); | ||
| return () => focusTimeoutRef.current && clearTimeout(focusTimeoutRef.current); | ||
| }, [isNewManualExpenseFlowEnabled]), | ||
| ); | ||
|
|
||
| const isCompactMode = !showMoreFields && isScanRequest && !isInLandscapeMode; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When the old money-request flow is advanced by keyboard (for example, tab to the previous step's Next button and press Enter/Space), React Navigation's stack can leave that previous control focused while the confirmation screen is pushed. The confirmation CTA relies on Useful? React with 👍 / 👎.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. True, now it keeps back button focused after entering the confirmation screen via keyboard. Will restore the blur then Screen.Recording.2026-06-01.at.16.04.56.mov |
||
| const selectionListStyle = { | ||
| containerStyle: [styles.flexBasisAuto], | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| import type {RefObject} from 'react'; | ||
| import type {View} from 'react-native'; | ||
|
|
||
| type UseDialogContainerFocus = (ref: RefObject<View | null>, isReady: boolean, claimInitialFocus?: () => boolean) => void; | ||
| type UseDialogContainerFocus = (ref: RefObject<View | null>, isReady: boolean, claimInitialFocus?: () => boolean, skipDialogContainerFocus?: boolean) => void; | ||
|
|
||
| export default UseDialogContainerFocus; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MoneyRequestConfirmationListImportant: The removed
useFocusEffect+blurActiveElementlogic was running for all consumers ofMoneyRequestConfirmationList(when!isNewManualExpenseFlowEnabled). By removing this blurring behavior entirely without replacing it on a per-flow basis, any other flow using this component that does not also passshouldSkipFocusAfterTransitionto its header will now retain focus on the first interactive element in the header (e.g., the back button), which could break keyboard/screen reader navigation in flows that previously relied on the blur.Why this matters: The old code was a global workaround for a local problem. Removing it is correct, but the fix (
shouldSkipFocusAfterTransition) is currently only applied inIOURequestStepConfirmation.tsx. IfMoneyRequestConfirmationListis used within other modals or RHP panels, they might now exhibit incorrect focus behavior.Suggested fix / verification: Add a quick audit or grep to identify all direct consumers of
MoneyRequestConfirmationList. For example:For any other non-deprecated consumers, verify if the focus landing on the back button is problematic. If it is, those flows should also receive
shouldSkipFocusAfterTransitionon their respectiveHeaderWithBackButton(or their wrapper should handle focus differently).Severity: Medium — could cause keyboard navigation regressions in untested flows.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other components using
MoneyRequestConfirmationList:Screen.Recording.2026-06-10.at.08.35.15.mov