From 44b2ca1830966e6cef49835388ad7688161abcd9 Mon Sep 17 00:00:00 2001 From: David <33458145+davidmcpowell@users.noreply.github.com> Date: Fri, 25 Oct 2024 14:20:08 +0100 Subject: [PATCH] Manually force blur on submitting an edited message (#21333) * Return focus to parent entry element after message is edited * Revert "Return focus to parent entry element after message is edited" This reverts commit 96234a666e7e7c17b99a23a8a92ea030efe6083f. * Manually force blur on submitting an edited message * Show review panel entry header when editing comment (#21397) * Show review panel entry header when editing comment * edit comment spacing * hide comment options when editing --------- Co-authored-by: Domagoj Kriskovic GitOrigin-RevId: 66a8d1ed772cf91ea0f086bd08cdabaeb7456956 --- .../components/review-panel-message.tsx | 59 +++++++++---------- .../app/editor/review-panel-new.less | 4 ++ .../pages/editor/review-panel-new.scss | 4 ++ 3 files changed, 36 insertions(+), 31 deletions(-) diff --git a/services/web/frontend/js/features/review-panel-new/components/review-panel-message.tsx b/services/web/frontend/js/features/review-panel-new/components/review-panel-message.tsx index d1eb34f7e4..2104c8af8f 100644 --- a/services/web/frontend/js/features/review-panel-new/components/review-panel-message.tsx +++ b/services/web/frontend/js/features/review-panel-new/components/review-panel-message.tsx @@ -51,32 +51,6 @@ export const ReviewPanelMessage: FC<{ setDeleting(false) }, [onDelete]) - if (editing) { - return ( -
- setContent(e.target.value)} - onKeyDown={e => { - if ( - e.key === 'Enter' && - !e.shiftKey && - !e.ctrlKey && - !e.metaKey && - content - ) { - e.preventDefault() - handleSubmit() - } - }} - value={content} - autoFocus // eslint-disable-line jsx-a11y/no-autofocus - /> -
- ) - } - return (
@@ -90,7 +64,7 @@ export const ReviewPanelMessage: FC<{
- {!isReply && !isThreadResolved && ( + {!editing && !isReply && !isThreadResolved && ( )} - {!isThreadResolved && ( + {!editing && !isThreadResolved && (
- - {message.content} - + {editing ? ( + setContent(e.target.value)} + onKeyDown={e => { + if ( + e.key === 'Enter' && + !e.shiftKey && + !e.ctrlKey && + !e.metaKey && + content + ) { + e.preventDefault() + ;(e.target as HTMLTextAreaElement).blur() + } + }} + value={content} + autoFocus // eslint-disable-line jsx-a11y/no-autofocus + /> + ) : ( + + {message.content} + + )} + {deleting && (