Skip to content

Commit

Permalink
ignore Enter on composition for Japanese
Browse files Browse the repository at this point in the history
  • Loading branch information
chakku000 committed Jul 12, 2023
1 parent 4ed2690 commit 10e756d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const isEnterKeyPressed = (
// https://bugs.chromium.org/p/chromium/issues/detail?id=79407

const { keyCode, key } = event
return key === "Enter" || keyCode === 13 || keyCode === 10
return (key === "Enter" || keyCode === 13 || keyCode === 10) && !event.nativeEvent.isComposing
}

function ChatInput({ width, element, widgetMgr }: Props): React.ReactElement {
Expand Down
2 changes: 1 addition & 1 deletion frontend/lib/src/components/widgets/TextArea/TextArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ class TextArea extends React.PureComponent<Props, State> {

// Using keyCode as well due to some different behaviors on Windows
// https://bugs.chromium.org/p/chromium/issues/detail?id=79407
return key === "Enter" || keyCode === 13 || keyCode === 10
return (key === "Enter" || keyCode === 13 || keyCode === 10) && !event.nativeEvent.isComposing
}

private onKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>): void => {
Expand Down

0 comments on commit 10e756d

Please sign in to comment.