fix: Ignore Enter pressed during IME composition in input fields
Closes #1703
This commit is contained in:
@@ -15,7 +15,7 @@ import selectors from '../../../selectors';
|
||||
import entryActions from '../../../entry-actions';
|
||||
import { useForm, useNestedRef } from '../../../hooks';
|
||||
import { focusEnd } from '../../../utils/element-helpers';
|
||||
import { isModifierKeyPressed } from '../../../utils/event-helpers';
|
||||
import { isComposing, isModifierKeyPressed } from '../../../utils/event-helpers';
|
||||
|
||||
import styles from './AddTask.module.scss';
|
||||
|
||||
@@ -87,6 +87,10 @@ const AddTask = React.memo(({ children, taskListId, isOpened, onClose }) => {
|
||||
|
||||
const handleFieldKeyDown = useCallback(
|
||||
(event) => {
|
||||
if (isComposing(event)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.key === 'Enter') {
|
||||
if (!isLinkingToCard) {
|
||||
event.preventDefault();
|
||||
|
||||
@@ -15,6 +15,7 @@ import selectors from '../../../../selectors';
|
||||
import entryActions from '../../../../entry-actions';
|
||||
import { useField, useNestedRef } from '../../../../hooks';
|
||||
import { focusEnd } from '../../../../utils/element-helpers';
|
||||
import { isComposing } from '../../../../utils/event-helpers';
|
||||
|
||||
import styles from './EditName.module.scss';
|
||||
|
||||
@@ -50,6 +51,10 @@ const EditName = React.memo(({ taskId, onClose }) => {
|
||||
|
||||
const handleFieldKeyDown = useCallback(
|
||||
(event) => {
|
||||
if (isComposing(event)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.key === 'Enter') {
|
||||
event.preventDefault();
|
||||
submit();
|
||||
|
||||
Reference in New Issue
Block a user