From 0ddd994f9827bf2d3cbef361deac11fd62e84c9b Mon Sep 17 00:00:00 2001 From: Bohdan Triapitsyn Date: Wed, 9 Sep 2026 08:25:44 +0300 Subject: [PATCH] fix(comments): attach code comments on Enter Code comments required Cmd/Ctrl+Enter while quotes and browser annotations used Enter. Align desktop submission and its placeholder, preserve Shift+Enter line breaks and mobile keyboard behavior. Validated UI type-check, UI lint, and six existing IME checks. Lint reports one existing warning in MobileChangesSurface. In-app browser validation was unavailable. --- .../ui/src/components/comments/InlineCommentInput.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/ui/src/components/comments/InlineCommentInput.tsx b/packages/ui/src/components/comments/InlineCommentInput.tsx index 0fb1ef61..5ebdaf7c 100644 --- a/packages/ui/src/components/comments/InlineCommentInput.tsx +++ b/packages/ui/src/components/comments/InlineCommentInput.tsx @@ -39,7 +39,7 @@ export function InlineCommentInput({ const { isMobile } = useDeviceInfo(); const [text, setText] = React.useState(initialText); const textareaRef = useRef(null); - const saveShortcut = formatShortcutForDisplay('mod+enter'); + const saveShortcut = formatShortcutForDisplay('enter'); void isEditing; const handleTextChange = (value: string) => { @@ -124,9 +124,9 @@ export function InlineCommentInput({ const handleKeyDown = (e: React.KeyboardEvent) => { if (isIMECompositionEvent(e)) return; - // As the placeholder promises: Cmd/Ctrl+Enter attaches, plain Enter - // breaks the line, Escape cancels. - if ((e.metaKey || e.ctrlKey) && e.key === 'Enter') { + // Desktop Enter attaches; Shift+Enter and mobile Enter break the line. + // Keep Cmd/Ctrl+Enter available for hardware keyboards on mobile. + if (e.key === 'Enter' && !e.shiftKey && (!isMobile || e.metaKey || e.ctrlKey)) { e.preventDefault(); save(); } else if (e.key === 'Escape') {