diff --git a/.changeset/tame-garlics-help.md b/.changeset/tame-garlics-help.md new file mode 100644 index 000000000..faabcd2f6 --- /dev/null +++ b/.changeset/tame-garlics-help.md @@ -0,0 +1,5 @@ +--- +"@assistant-ui/react": patch +--- + +fix: do not capture enter key during IME composition events diff --git a/packages/react/src/primitives/composer/ComposerInput.tsx b/packages/react/src/primitives/composer/ComposerInput.tsx index bf6e1234b..9733310ef 100644 --- a/packages/react/src/primitives/composer/ComposerInput.tsx +++ b/packages/react/src/primitives/composer/ComposerInput.tsx @@ -62,6 +62,9 @@ export const ComposerPrimitiveInput = forwardRef< const handleKeyPress = (e: KeyboardEvent) => { if (isDisabled) return; + // ignore IME composition events + if (e.nativeEvent.isComposing) return; + if (e.key === "Enter" && e.shiftKey === false) { const { isRunning } = useThread.getState();