Skip to content

Commit

Permalink
Merge pull request #53328 from FitseTLT/fix-focus-regain-of-composer
Browse files Browse the repository at this point in the history
Fix - The Composer isn't getting focus again after the attachment modal is dismissed
  • Loading branch information
grgia authored Dec 4, 2024
2 parents 00f0dee + ad9bf4d commit 43cbee3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/libs/focusComposerWithDelay/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ function focusComposerWithDelay(textInput: InputType | null): FocusComposerWithD
if (!textInput) {
return;
}
textInput.focus();
// When the closing modal has a focused text input focus() needs a delay to properly work.
setTimeout(() => textInput.focus(), 0);
if (forcedSelectionRange) {
setTextInputSelection(textInput, forcedSelectionRange);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,12 @@ function ReportActionCompose({
raiseIsScrollLikelyLayoutTriggered={raiseIsScrollLikelyLayoutTriggered}
onAddActionPressed={onAddActionPressed}
onItemSelected={onItemSelected}
onCanceledAttachmentPicker={() => {
if (!shouldFocusInputOnScreenFocus) {
return;
}
focus();
}}
actionButtonRef={actionButtonRef}
shouldDisableAttachmentItem={hasExceededMaxCommentLength}
/>
Expand Down

0 comments on commit 43cbee3

Please sign in to comment.