diff --git a/src/libs/willBlurTextInputOnTapOutside/index.ts b/src/libs/willBlurTextInputOnTapOutside/index.ts index 987d8a1dfeea..31a40932189e 100644 --- a/src/libs/willBlurTextInputOnTapOutside/index.ts +++ b/src/libs/willBlurTextInputOnTapOutside/index.ts @@ -1,5 +1,6 @@ +import getIsNarrowLayout from '@libs/getIsNarrowLayout'; import type WillBlurTextInputOnTapOutside from './types'; -const willBlurTextInputOnTapOutside: WillBlurTextInputOnTapOutside = () => true; +const willBlurTextInputOnTapOutside: WillBlurTextInputOnTapOutside = () => !getIsNarrowLayout(); export default willBlurTextInputOnTapOutside; diff --git a/src/pages/home/report/ReportActionCompose/AttachmentPickerWithMenuItems.tsx b/src/pages/home/report/ReportActionCompose/AttachmentPickerWithMenuItems.tsx index 28d985537ff5..4fc7cc137068 100644 --- a/src/pages/home/report/ReportActionCompose/AttachmentPickerWithMenuItems.tsx +++ b/src/pages/home/report/ReportActionCompose/AttachmentPickerWithMenuItems.tsx @@ -67,10 +67,10 @@ type AttachmentPickerWithMenuItemsProps = { onTriggerAttachmentPicker: () => void; /** Called when cancelling the attachment picker */ - onCanceledAttachmentPicker: () => void; + onCanceledAttachmentPicker?: () => void; /** Called when the menu with the items is closed after it was open */ - onMenuClosed: () => void; + onMenuClosed?: () => void; /** Called when the add action button is pressed */ onAddActionPressed: () => void; @@ -192,7 +192,7 @@ function AttachmentPickerWithMenuItems({ const onPopoverMenuClose = () => { setMenuVisibility(false); - onMenuClosed(); + onMenuClosed?.(); }; const prevIsFocused = usePrevious(isFocused); diff --git a/src/pages/home/report/ReportActionCompose/ReportActionCompose.tsx b/src/pages/home/report/ReportActionCompose/ReportActionCompose.tsx index 69bceec2bd9f..e4b0eef6ca52 100644 --- a/src/pages/home/report/ReportActionCompose/ReportActionCompose.tsx +++ b/src/pages/home/report/ReportActionCompose/ReportActionCompose.tsx @@ -207,13 +207,6 @@ function ReportActionCompose({ const isKeyboardVisibleWhenShowingModalRef = useRef(false); const isNextModalWillOpenRef = useRef(false); - const restoreKeyboardState = useCallback(() => { - if (!isKeyboardVisibleWhenShowingModalRef.current || isNextModalWillOpenRef.current) { - return; - } - focus(); - isKeyboardVisibleWhenShowingModalRef.current = false; - }, []); const containerRef = useRef(null); const measureContainer = useCallback( @@ -263,8 +256,7 @@ function ReportActionCompose({ const onAttachmentPreviewClose = useCallback(() => { updateShouldShowSuggestionMenuToFalse(); setIsAttachmentPreviewActive(false); - restoreKeyboardState(); - }, [updateShouldShowSuggestionMenuToFalse, restoreKeyboardState]); + }, [updateShouldShowSuggestionMenuToFalse]); /** * Add a new comment to this chat @@ -455,11 +447,6 @@ function ReportActionCompose({ isMenuVisible={isMenuVisible} onTriggerAttachmentPicker={onTriggerAttachmentPicker} raiseIsScrollLikelyLayoutTriggered={raiseIsScrollLikelyLayoutTriggered} - onCanceledAttachmentPicker={() => { - isNextModalWillOpenRef.current = false; - restoreKeyboardState(); - }} - onMenuClosed={restoreKeyboardState} onAddActionPressed={onAddActionPressed} onItemSelected={onItemSelected} actionButtonRef={actionButtonRef}