Merge pull request #1721 from babu-ch/fix/ime-composition-enter-submit
fix: Ignore Enter pressed during IME composition in input fields
This commit is contained in:
@@ -9,6 +9,7 @@ import { useDidUpdate, usePrevious, useToggle } from '../../../lib/hooks';
|
||||
import { Input } from '../../../lib/custom-ui';
|
||||
|
||||
import { useEscapeInterceptor, useField, useNestedRef } from '../../../hooks';
|
||||
import { isComposing } from '../../../utils/event-helpers';
|
||||
|
||||
import styles from './ValueField.module.scss';
|
||||
|
||||
@@ -35,6 +36,10 @@ const ValueField = React.memo(({ defaultValue, onUpdate, ...props }) => {
|
||||
|
||||
const handleKeyDown = useCallback(
|
||||
(event) => {
|
||||
if (isComposing(event)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.key === 'Enter') {
|
||||
event.preventDefault();
|
||||
fieldRef.current.blur();
|
||||
|
||||
Reference in New Issue
Block a user