Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions src/ONYXKEYS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,6 @@ const ONYXKEYS = {
// draft status in custom mode (date and time)
STATUS_DRAFT_CUSTOM_CLEAR_AFTER_DATE: 'statusDraftCustomClearAfterDate',

// keep edit message focus state
INPUT_FOCUSED: 'inputFocused',

/** Contains all the personalDetails the user has access to, keyed by accountID */
PERSONAL_DETAILS_LIST: 'personalDetailsList',

Expand Down Expand Up @@ -1190,7 +1187,6 @@ type OnyxValuesMapping = {
[ONYXKEYS.NEW_GROUP_CHAT_DRAFT]: OnyxTypes.NewGroupChatDraft;
[ONYXKEYS.CUSTOM_STATUS_DRAFT]: OnyxTypes.CustomStatusDraft;
[ONYXKEYS.STATUS_DRAFT_CUSTOM_CLEAR_AFTER_DATE]: string;
[ONYXKEYS.INPUT_FOCUSED]: boolean;
[ONYXKEYS.PERSONAL_DETAILS_LIST]: OnyxTypes.PersonalDetailsList;
[ONYXKEYS.PRIVATE_PERSONAL_DETAILS]: OnyxTypes.PrivatePersonalDetails;
[ONYXKEYS.PERSONAL_DETAILS_METADATA]: Record<string, OnyxTypes.PersonalDetailsMetadata>;
Expand Down
1 change: 0 additions & 1 deletion src/components/AddPaymentMethodMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ function AddPaymentMethodMenu({
// },
// ],
]}
shouldEnableNewFocusManagement
restoreFocusType={restoreFocusType}
/>
);
Expand Down
4 changes: 2 additions & 2 deletions src/components/BaseMiniContextMenuItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import type {PressableStateCallbackType} from 'react-native';
import {View} from 'react-native';
import useStyleUtils from '@hooks/useStyleUtils';
import useThemeStyles from '@hooks/useThemeStyles';
import ComposerFocusManager from '@libs/ComposerFocusManager';
import DomUtils from '@libs/DomUtils';
import getButtonState from '@libs/getButtonState';
import ReportActionComposeFocusManager from '@libs/ReportActionComposeFocusManager';
import variables from '@styles/variables';
import CONST from '@src/CONST';
import type WithSentryLabel from '@src/types/utils/SentryLabel';
Expand Down Expand Up @@ -68,7 +68,7 @@ function BaseMiniContextMenuItem({
ref={ref}
onPress={onPress}
onMouseDown={(event) => {
if (!ReportActionComposeFocusManager.isFocused() && !ReportActionComposeFocusManager.isEditFocused()) {
if (!ComposerFocusManager.isComposerFocused() && !ComposerFocusManager.isEditComposerFocused()) {
const activeElement = DomUtils.getActiveElement();
if (activeElement instanceof HTMLElement) {
activeElement?.blur();
Expand Down
8 changes: 0 additions & 8 deletions src/components/ConfirmModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,6 @@ type ConfirmModalProps = {
/** Styles for the image */
imageStyles?: StyleProp<ViewStyle>;

/**
* Whether the modal should enable the new focus manager.
* We are attempting to migrate to a new refocus manager, adding this property for gradual migration.
* */
shouldEnableNewFocusManagement?: boolean;

/** How to re-focus after the modal is dismissed */
restoreFocusType?: BaseModalProps['restoreFocusType'];

Expand Down Expand Up @@ -147,7 +141,6 @@ function ConfirmModal({
shouldShowDismissIcon,
titleContainerStyles,
shouldReverseStackedButtons,
shouldEnableNewFocusManagement,
restoreFocusType,
isConfirmLoading,
shouldHandleNavigationBack,
Expand Down Expand Up @@ -175,7 +168,6 @@ function ConfirmModal({
onModalHide={onModalHide}
type={isSmallScreenWidth ? CONST.MODAL.MODAL_TYPE.BOTTOM_DOCKED : CONST.MODAL.MODAL_TYPE.CONFIRM}
innerContainerStyle={styles.pv0}
shouldEnableNewFocusManagement={shouldEnableNewFocusManagement}
restoreFocusType={restoreFocusType}
shouldHandleNavigationBack={shouldHandleNavigationBack}
shouldIgnoreBackHandlerDuringTransition={shouldIgnoreBackHandlerDuringTransition}
Expand Down
1 change: 0 additions & 1 deletion src/components/CurrencyPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ function CurrencyPicker({label, value, errorText, headerContent, excludeCurrenci
isVisible={isPickerVisible}
onClose={hidePickerModal}
onModalHide={hidePickerModal}
shouldEnableNewFocusManagement
onBackdropPress={Navigation.dismissModal}
shouldUseModalPaddingStyle={false}
shouldHandleNavigationBack
Expand Down
1 change: 0 additions & 1 deletion src/components/DatePicker/DatePickerModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ function DatePickerModal({
anchorAlignment={DEFAULT_ANCHOR_ORIGIN}
restoreFocusType={CONST.MODAL.RESTORE_FOCUS_TYPE.DELETE}
shouldSwitchPositionIfOverflow
shouldEnableNewFocusManagement
shouldMeasureAnchorPositionFromTop={shouldPositionFromTop}
shouldSkipRemeasurement
forwardedFSClass={forwardedFSClass}
Expand Down
14 changes: 4 additions & 10 deletions src/components/EmojiPicker/EmojiPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ import blurActiveElement from '@libs/Accessibility/blurActiveElement';
import type {AnchorOrigin, EmojiPickerOnModalHide, EmojiPickerRef, EmojiPopoverAnchor, OnEmojiSelected, ShowEmojiPickerOptions} from '@libs/actions/EmojiPickerAction';
import {isMobileChrome} from '@libs/Browser';
import calculateAnchorPosition from '@libs/calculateAnchorPosition';
import ComposerFocusManager from '@libs/ComposerFocusManager';
import type {ComposerType} from '@libs/ComposerFocusManager';
import DomUtils from '@libs/DomUtils';
import refocusComposerAfterPreventFirstResponder from '@libs/refocusComposerAfterPreventFirstResponder';
import type {ComposerType} from '@libs/ReportActionComposeFocusManager';
import ReportActionComposeFocusManager from '@libs/ReportActionComposeFocusManager';
import {close} from '@userActions/Modal';
import CONST from '@src/CONST';
import KeyboardUtils from '@src/utils/keyboard';
Expand Down Expand Up @@ -97,11 +96,7 @@ function EmojiPicker({viewportOffsetTop, ref}: EmojiPickerProps) {
});

composerToRefocusOnClose.current = composerToRefocusOnCloseValue;
if (composerToRefocusOnCloseValue === 'main') {
ReportActionComposeFocusManager.preventComposerFocusOnFirstResponderOnce();
} else if (composerToRefocusOnCloseValue === 'edit') {
ReportActionComposeFocusManager.preventEditComposerFocusOnFirstResponderOnce();
}
ComposerFocusManager.preventComposerFocusOnFirstResponderOnce(composerToRefocusOnCloseValue);

onModalHide.current = onModalHideValue;
onEmojiSelected.current = onEmojiSelectedValue;
Expand Down Expand Up @@ -164,7 +159,7 @@ function EmojiPicker({viewportOffsetTop, ref}: EmojiPickerProps) {
const handleModalHide = () => {
onModalHide.current();

refocusComposerAfterPreventFirstResponder(composerToRefocusOnClose.current).then(() => {
ComposerFocusManager.refocusComposerAfterPreventFirstResponder(composerToRefocusOnClose.current).then(() => {
composerToRefocusOnClose.current = undefined;
});
};
Expand Down Expand Up @@ -259,7 +254,6 @@ function EmojiPicker({viewportOffsetTop, ref}: EmojiPickerProps) {
anchorDimensions={emojiAnchorDimension.current}
avoidKeyboard
shouldSwitchPositionIfOverflow
shouldEnableNewFocusManagement
restoreFocusType={CONST.MODAL.RESTORE_FOCUS_TYPE.DELETE}
shouldSkipRemeasurement
>
Expand Down
4 changes: 2 additions & 2 deletions src/components/FocusTrap/FocusTrapForModal/index.web.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {FocusTrap} from 'focus-trap-react';
import React from 'react';
import sharedTrapStack from '@components/FocusTrap/sharedTrapStack';
import blurActiveElement from '@libs/Accessibility/blurActiveElement';
import ReportActionComposeFocusManager from '@libs/ReportActionComposeFocusManager';
import ComposerFocusManager from '@libs/ComposerFocusManager';
import type FocusTrapForModalProps from './FocusTrapForModalProps';

function FocusTrapForModal({children, active, initialFocus = false, shouldPreventScroll = false, shouldReturnFocus = true}: FocusTrapForModalProps) {
Expand All @@ -17,7 +17,7 @@ function FocusTrapForModal({children, active, initialFocus = false, shouldPreven
initialFocus,
fallbackFocus: document.body,
setReturnFocus: (element) => {
if (ReportActionComposeFocusManager.isFocused()) {
if (ComposerFocusManager.isComposerFocused()) {
return false;
}
if (shouldReturnFocus) {
Expand Down
4 changes: 2 additions & 2 deletions src/components/LHNOptionsList/OptionRowLHN.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useStyleUtils from '@hooks/useStyleUtils';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import ComposerFocusManager from '@libs/ComposerFocusManager';
import DateUtils from '@libs/DateUtils';
import DomUtils from '@libs/DomUtils';
import {containsCustomEmoji as containsCustomEmojiUtils, containsOnlyCustomEmoji} from '@libs/EmojiUtils';
import FS from '@libs/Fullstory';
import {shouldOptionShowTooltip, shouldUseBoldText} from '@libs/OptionsListUtils';
import Performance from '@libs/Performance';
import ReportActionComposeFocusManager from '@libs/ReportActionComposeFocusManager';
import {isAdminRoom, isChatUsedForOnboarding as isChatUsedForOnboardingReportUtils, isConciergeChatReport, isGroupChat, isOneOnOneChat, isSystemChat} from '@libs/ReportUtils';
import {startSpan} from '@libs/telemetry/activeSpans';
import TextWithEmojiFragment from '@pages/home/report/comment/TextWithEmojiFragment';
Expand Down Expand Up @@ -184,7 +184,7 @@ function OptionRowLHN({

event?.preventDefault();
// Enable Composer to focus on clicking the same chat after opening the context menu.
ReportActionComposeFocusManager.focus();
ComposerFocusManager.focusComposer();
hideProductTrainingTooltip();
onSelectRow(optionItem, popoverAnchor);
};
Expand Down
8 changes: 2 additions & 6 deletions src/components/Modal/BaseModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ function BaseModal({
shouldUseCustomBackdrop = false,
onBackdropPress,
modalId,
shouldEnableNewFocusManagement = false,
restoreFocusType,
shouldUseModalPaddingStyle = true,
initialFocus = false,
Expand Down Expand Up @@ -97,11 +96,9 @@ function BaseModal({

const uniqueModalId = useMemo(() => modalId ?? ComposerFocusManager.getId(), [modalId]);
const saveFocusState = useCallback(() => {
if (shouldEnableNewFocusManagement) {
ComposerFocusManager.saveFocusState(uniqueModalId);
}
ComposerFocusManager.saveFocusState(uniqueModalId);
ComposerFocusManager.resetReadyToFocus(uniqueModalId);
}, [shouldEnableNewFocusManagement, uniqueModalId]);
}, [uniqueModalId]);
/**
* Hides modal
* @param callHideCallback - Should we call the onModalHide callback
Expand Down Expand Up @@ -367,7 +364,6 @@ function BaseModal({
customBackdrop={shouldUseCustomBackdrop ? <Overlay onPress={handleBackdropPress} /> : undefined}
type={type}
shouldIgnoreBackHandlerDuringTransition={shouldIgnoreBackHandlerDuringTransition}
shouldEnableNewFocusManagement={shouldEnableNewFocusManagement}
>
<Animated.View
onLayout={onViewLayout}
Expand Down
3 changes: 1 addition & 2 deletions src/components/Modal/ReanimatedModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ function ReanimatedModal({
shouldPreventScrollOnFocus,
initialFocus,
shouldIgnoreBackHandlerDuringTransition = false,
shouldEnableNewFocusManagement,
...props
}: ReanimatedModalProps) {
const [isVisibleState, setIsVisibleState] = useState(isVisible);
Expand Down Expand Up @@ -242,7 +241,7 @@ function ReanimatedModal({
<FocusTrapForModal
active={modalVisibility}
initialFocus={initialFocus}
shouldReturnFocus={!shouldEnableNewFocusManagement}
shouldReturnFocus={false}
shouldPreventScroll={shouldPreventScrollOnFocus}
>
{isVisibleState && containerView}
Expand Down
6 changes: 0 additions & 6 deletions src/components/Modal/ReanimatedModal/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,6 @@ type ReanimatedModalProps = ViewProps &
/** Whether to use a custom backdrop for the modal? (This prevents focus issues on desktop) */
initialFocus?: FocusTrapOptions['initialFocus'];

/**
* Whether the modal should enable the new focus manager.
* We are attempting to migrate to a new refocus manager, adding this property for gradual migration.
* */
shouldEnableNewFocusManagement?: boolean;

/** Whether to ignore the back handler during transition */
shouldIgnoreBackHandlerDuringTransition?: boolean;
};
Expand Down
6 changes: 0 additions & 6 deletions src/components/Modal/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,6 @@ type BaseModalProps = Partial<ReanimatedModalProps> &
/** Unique id for the modal */
modalId?: number;

/**
* Whether the modal should enable the new focus manager.
* We are attempting to migrate to a new refocus manager, adding this property for gradual migration.
* */
shouldEnableNewFocusManagement?: boolean;

/** How to re-focus after the modal is dismissed */
restoreFocusType?: ValueOf<typeof CONST.MODAL.RESTORE_FOCUS_TYPE>;

Expand Down
1 change: 0 additions & 1 deletion src/components/MoneyRequestHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,6 @@ function MoneyRequestHeader({report, parentReportAction, policy, onBackButtonPre
confirmText={translate('common.delete')}
cancelText={translate('common.cancel')}
danger
shouldEnableNewFocusManagement
/>
{!!rejectModalAction && (
<HoldOrRejectEducationalModal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,6 @@ function MoneyRequestReportActionsList({
confirmText={translate('common.delete')}
cancelText={translate('common.cancel')}
danger
shouldEnableNewFocusManagement
/>
</>
)}
Expand Down
10 changes: 1 addition & 9 deletions src/components/PopoverMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,6 @@ type PopoverMenuProps = Partial<ModalAnimationProps> & {
/** Whether we want to show the popover on the right side of the screen */
fromSidebarMediumScreen?: boolean;

/**
* Whether the modal should enable the new focus manager.
* We are attempting to migrate to a new refocus manager, adding this property for gradual migration.
* */
shouldEnableNewFocusManagement?: boolean;

/** How to re-focus after the modal is dismissed */
restoreFocusType?: BaseModalProps['restoreFocusType'];

Expand Down Expand Up @@ -270,7 +264,6 @@ function BasePopoverMenu({
disableAnimation = true,
withoutOverlay = false,
shouldSetModalVisibility = true,
shouldEnableNewFocusManagement,
restoreFocusType,
shouldShowSelectedItemCheck = false,
containerStyles,
Expand Down Expand Up @@ -559,15 +552,14 @@ function BasePopoverMenu({
fromSidebarMediumScreen={fromSidebarMediumScreen}
withoutOverlay={withoutOverlay}
shouldSetModalVisibility={shouldSetModalVisibility}
shouldEnableNewFocusManagement={shouldEnableNewFocusManagement}
restoreFocusType={restoreFocusType}
innerContainerStyle={{...styles.pv0, ...innerContainerStyle}}
shouldUseModalPaddingStyle={shouldUseModalPaddingStyle}
testID={testID}
>
<FocusTrapForModal
active={isVisible}
shouldReturnFocus={!shouldEnableNewFocusManagement}
shouldReturnFocus={false}
>
<View
onLayout={onLayout}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ function PopoverWithMeasuredContentBase({
},
shouldSwitchPositionIfOverflow = false,
shouldHandleNavigationBack = false,
shouldEnableNewFocusManagement,
shouldMeasureAnchorPositionFromTop = false,
shouldSkipRemeasurement = false,
...props
Expand All @@ -63,13 +62,6 @@ function PopoverWithMeasuredContentBase({
const hasStaticDimensions = popoverDimensions.width > 0 && popoverDimensions.height > 0;
const modalId = useMemo(() => ComposerFocusManager.getId(), []);

useEffect(() => {
if (prevIsVisible || !isVisible || !shouldEnableNewFocusManagement) {
return;
}
ComposerFocusManager.saveFocusState(modalId);
}, [isVisible, shouldEnableNewFocusManagement, prevIsVisible, modalId]);

if (!prevIsVisible && isVisible && isContentMeasured && !shouldSkipRemeasurement) {
// Check if anything significant changed that would require re-measurement
const hasAnchorPositionChanged = !deepEqual(prevAnchorPosition, anchorPosition);
Expand Down Expand Up @@ -203,7 +195,6 @@ function PopoverWithMeasuredContentBase({
avoidKeyboard={avoidKeyboard}
hideModalContentWhileAnimating={hideModalContentWhileAnimating}
modalId={modalId}
shouldEnableNewFocusManagement={shouldEnableNewFocusManagement}
// eslint-disable-next-line react/jsx-props-no-spreading
{...props}
anchorPosition={shiftedAnchorPosition}
Expand Down
9 changes: 1 addition & 8 deletions src/components/RequireTwoFactorAuthenticationModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,9 @@ type RequireTwoFactorAuthenticationModalProps = {

/** Describe what is showing */
description: string;

/**
* Whether the modal should enable the new focus manager.
* We are attempting to migrate to a new refocus manager, adding this property for gradual migration.
* */
shouldEnableNewFocusManagement?: boolean;
};

function RequireTwoFactorAuthenticationModal({onCancel = () => {}, description, isVisible, onSubmit, shouldEnableNewFocusManagement}: RequireTwoFactorAuthenticationModalProps) {
function RequireTwoFactorAuthenticationModal({onCancel = () => {}, description, isVisible, onSubmit}: RequireTwoFactorAuthenticationModalProps) {
const {shouldUseNarrowLayout} = useResponsiveLayout();
const styles = useThemeStyles();
const {translate} = useLocalize();
Expand All @@ -43,7 +37,6 @@ function RequireTwoFactorAuthenticationModal({onCancel = () => {}, description,
isVisible={isVisible}
type={shouldUseNarrowLayout ? CONST.MODAL.MODAL_TYPE.BOTTOM_DOCKED : CONST.MODAL.MODAL_TYPE.CONFIRM}
innerContainerStyle={{...styles.pb5, ...styles.pt0, ...styles.boxShadowNone}}
shouldEnableNewFocusManagement={shouldEnableNewFocusManagement}
>
<View>
<View style={[styles.cardSectionIllustration, styles.alignItemsCenter, StyleUtils.getBackgroundColorStyle(LottieAnimations.Safe.backgroundColor)]}>
Expand Down
1 change: 0 additions & 1 deletion src/components/Search/FilterDropdowns/DropdownButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ function DropdownButton({label, value, viewportOffsetTop, PopoverComponent, medi
anchorPosition={popoverTriggerPosition}
anchorAlignment={ANCHOR_ORIGIN}
restoreFocusType={CONST.MODAL.RESTORE_FOCUS_TYPE.DELETE}
shouldEnableNewFocusManagement
shouldMeasureAnchorPositionFromTop={false}
outerStyle={{...StyleUtils.getOuterModalStyle(windowHeight, viewportOffsetTop), ...containerStyles}}
// This must be false because we dont want the modal to close if we open the RHP for selections
Expand Down
2 changes: 1 addition & 1 deletion src/components/SidePanel/Concierge/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const CONCIERGE_REPORT_KEY = 'Report-Concierge-Key';
function Concierge({navigation}: Pick<ExtraContentProps, 'navigation'>) {
const [conciergeReportID] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID, {canBeMissing: true});
// eslint-disable-next-line react/jsx-no-constructed-context-values
const route = !!conciergeReportID && ({name: SCREENS.REPORT, params: {reportID: conciergeReportID}, key: CONCIERGE_REPORT_KEY} as const);
const route = !!conciergeReportID && ({name: SCREENS.REPORT, params: {reportID: '803938620872427'}, key: CONCIERGE_REPORT_KEY} as const);

if (!route) {
return null;
Expand Down
Loading