From 32b89be8f40a358ed9ad61c517f47e357324c286 Mon Sep 17 00:00:00 2001 From: s-alves10 Date: Wed, 6 Dec 2023 16:24:39 -0600 Subject: [PATCH] fix: change onyxFocused state on umount instead of deleteDraft --- src/pages/home/report/ReportActionItemMessageEdit.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pages/home/report/ReportActionItemMessageEdit.js b/src/pages/home/report/ReportActionItemMessageEdit.js index 1ed5db385f7a..bf8a871fa888 100644 --- a/src/pages/home/report/ReportActionItemMessageEdit.js +++ b/src/pages/home/report/ReportActionItemMessageEdit.js @@ -190,6 +190,9 @@ function ReportActionItemMessageEdit(props) { } return () => { + InputFocus.callback(() => setIsFocused(false)); + InputFocus.inputFocusChange(false); + // Skip if the current report action is not active if (!isActive()) { return; @@ -286,8 +289,6 @@ function ReportActionItemMessageEdit(props) { * Delete the draft of the comment being edited. This will take the comment out of "edit mode" with the old content. */ const deleteDraft = useCallback(() => { - InputFocus.callback(() => setIsFocused(false)); - InputFocus.inputFocusChange(false); debouncedSaveDraft.cancel(); Report.saveReportActionDraft(props.reportID, props.action, '');