Remove broken key/value enter/backspace logic

This commit is contained in:
Gregory Schier
2023-10-29 10:45:05 -07:00
parent 705e30b6e0
commit 9e2803fcfb
3 changed files with 29 additions and 69 deletions

View File

@@ -101,7 +101,10 @@ export const Input = forwardRef<EditorView | undefined, InputProps>(function Inp
const wrapperRef = useRef<HTMLDivElement>(null);
const handleEnter = useCallback(() => {
// Submit nearest form on Enter key press
const handleKeyDown = useCallback((e: KeyboardEvent) => {
if (e.key !== 'Enter') return;
const form = wrapperRef.current?.closest('form');
if (!isValid || form == null) return;
@@ -147,7 +150,7 @@ export const Input = forwardRef<EditorView | undefined, InputProps>(function Inp
id={id}
singleLine
wrapLines={size === 'auto'}
onEnter={handleEnter}
onKeyDown={handleKeyDown}
type={type === 'password' && !obscured ? 'text' : type}
defaultValue={defaultValue}
forceUpdateKey={forceUpdateKey}