From e71539d4d441ac7a922f836e761a1d8533d5e57d Mon Sep 17 00:00:00 2001 From: nicholas Date: Tue, 11 Jan 2022 12:10:05 +0100 Subject: [PATCH] Remove composition handling & full width char conversion from InputBase.tsx --- .../internal/FormFields/InputBase.tsx | 24 +------------------ 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/packages/lib/src/components/internal/FormFields/InputBase.tsx b/packages/lib/src/components/internal/FormFields/InputBase.tsx index 4e26ab0692..c8fb2518a5 100644 --- a/packages/lib/src/components/internal/FormFields/InputBase.tsx +++ b/packages/lib/src/components/internal/FormFields/InputBase.tsx @@ -1,36 +1,17 @@ import { h } from 'preact'; -import { useState, useCallback, useRef } from 'preact/hooks'; +import { useState, useCallback } from 'preact/hooks'; import classNames from 'classnames'; -import { convertFullToHalf } from './utils'; import { ARIA_ERROR_SUFFIX } from '../../../core/Errors/constants'; export default function InputBase(props) { const { autoCorrect, classNameModifiers, isInvalid, isValid, readonly = null, spellCheck, type, uniqueId, isCollatingErrors } = props; const [handleChangeHasFired, setHandleChangeHasFired] = useState(false); - const isOnComposition = useRef(false); const handleInput = useCallback((event: h.JSX.TargetedCompositionEvent) => { - if (isOnComposition.current) return; - - (event.target as HTMLInputElement).value = convertFullToHalf((event.target as HTMLInputElement).value); - props.onInput(event); }, []); - const handleOnCompositionStart = useCallback(() => { - isOnComposition.current = true; - }, []); - - const handleOnCompositionUpdate = useCallback((event: h.JSX.TargetedCompositionEvent) => { - props.onInput(event); - }, []); - - const handleOnCompositionEnd = useCallback((event: h.JSX.TargetedCompositionEvent) => { - isOnComposition.current = false; - handleInput(event); - }, []); - const handleChange = useCallback((event: h.JSX.TargetedCompositionEvent) => { setHandleChangeHasFired(true); props?.onChange?.(event); @@ -73,9 +54,6 @@ export default function InputBase(props) { onChange={handleChange} onBlur={handleBlur} aria-invalid={isInvalid} - onCompositionStart={handleOnCompositionStart} - onCompositionUpdate={handleOnCompositionUpdate} - onCompositionEnd={handleOnCompositionEnd} /> ); }