Skip to content

Commit 64db15e

Browse files
hashseedDevtools-frontend LUCI CQ
authored andcommitted
Fix: Prevent Enter from submitting form during IME composition
The previous implementation of the Enter key handler in the AI Assistant chat view did not account for IME composition. This caused the form to be submitted when the user pressed Enter to select an IME suggestion, rather than confirming the composition. [email protected] Fixed: 433181818 Change-Id: I10f51a8f4504cef03a5cbe43d0d18da6c8b13a75 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6771327 Commit-Queue: Yang Guo <[email protected]> Reviewed-by: Nikolay Vitkov <[email protected]>
1 parent 0c01db4 commit 64db15e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

front_end/panels/ai_assistance/components/ChatView.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -529,8 +529,9 @@ export class ChatView extends HTMLElement {
529529
return;
530530
}
531531

532-
// Go to a new line only when Shift + Enter is pressed.
533-
if (ev.key === 'Enter' && !ev.shiftKey) {
532+
// Go to a new line on Shift+Enter. On Enter, submit unless the
533+
// user is in IME composition.
534+
if (ev.key === 'Enter' && !ev.shiftKey && !ev.isComposing) {
534535
ev.preventDefault();
535536
if (!ev.target?.value || this.#props.imageInput?.isLoading) {
536537
return;

0 commit comments

Comments
 (0)