Skip to content

Commit 43cbee3

Browse files
authored
Merge pull request #53328 from FitseTLT/fix-focus-regain-of-composer
Fix - The Composer isn't getting focus again after the attachment modal is dismissed
2 parents 00f0dee + ad9bf4d commit 43cbee3

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/libs/focusComposerWithDelay/index.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ function focusComposerWithDelay(textInput: InputType | null): FocusComposerWithD
3131
if (!textInput) {
3232
return;
3333
}
34-
textInput.focus();
34+
// When the closing modal has a focused text input focus() needs a delay to properly work.
35+
setTimeout(() => textInput.focus(), 0);
3536
if (forcedSelectionRange) {
3637
setTextInputSelection(textInput, forcedSelectionRange);
3738
}

src/pages/home/report/ReportActionCompose/ReportActionCompose.tsx

+6
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,12 @@ function ReportActionCompose({
462462
raiseIsScrollLikelyLayoutTriggered={raiseIsScrollLikelyLayoutTriggered}
463463
onAddActionPressed={onAddActionPressed}
464464
onItemSelected={onItemSelected}
465+
onCanceledAttachmentPicker={() => {
466+
if (!shouldFocusInputOnScreenFocus) {
467+
return;
468+
}
469+
focus();
470+
}}
465471
actionButtonRef={actionButtonRef}
466472
shouldDisableAttachmentItem={hasExceededMaxCommentLength}
467473
/>

0 commit comments

Comments
 (0)