Skip to content

Commit

Permalink
fix: add IME composition event handling to ComposerInput (#677)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yonom authored Aug 18, 2024
1 parent 3b627d2 commit ccf5fef
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/tame-garlics-help.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@assistant-ui/react": patch
---

fix: do not capture enter key during IME composition events
3 changes: 3 additions & 0 deletions packages/react/src/primitives/composer/ComposerInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit ccf5fef

Please sign in to comment.