diff options
Diffstat (limited to 'packages/bank/src/components/fields/EmailInput.tsx')
-rw-r--r-- | packages/bank/src/components/fields/EmailInput.tsx | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/packages/bank/src/components/fields/EmailInput.tsx b/packages/bank/src/components/fields/EmailInput.tsx index c643083..8b64264 100644 --- a/packages/bank/src/components/fields/EmailInput.tsx +++ b/packages/bank/src/components/fields/EmailInput.tsx @@ -14,9 +14,9 @@ export interface TextInputProps { export function EmailInput(props: TextInputProps): VNode { const inputRef = useRef<HTMLInputElement>(null); useLayoutEffect(() => { - if (props.grabFocus) { + if (props.grabFocus) inputRef.current?.focus(); - } + }, [props.grabFocus]); const value = props.bind[0]; const [dirty, setDirty] = useState(false); @@ -39,9 +39,9 @@ export function EmailInput(props: TextInputProps): VNode { type="email" class={showError ? 'input is-danger' : 'input'} onKeyPress={(e) => { - if (e.key === 'Enter' && props.onConfirm) { + if (e.key === 'Enter' && props.onConfirm) props.onConfirm() - } + }} onInput={(e) => { setDirty(true); |