From ae25d109fc5127d8c84a91f98edd0c67382eeff2 Mon Sep 17 00:00:00 2001 From: Luke Date: Fri, 26 Aug 2022 18:49:49 +0200 Subject: [PATCH] fix(web): move input dialog enter handler it was causing issues where when confirming a selection in the list menu it would instantly close the input dialog --- web/src/features/dialog/InputDialog.tsx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/web/src/features/dialog/InputDialog.tsx b/web/src/features/dialog/InputDialog.tsx index d2d15b9..dbcffd7 100644 --- a/web/src/features/dialog/InputDialog.tsx +++ b/web/src/features/dialog/InputDialog.tsx @@ -61,13 +61,8 @@ const InputDialog: React.FC = () => { >([]); const [passwordStates, setPasswordStates] = React.useState([]); const [visible, setVisible] = React.useState(false); - const enterPressed = useKeyPress("Enter"); const { locale } = useLocales(); - React.useEffect(() => { - if (visible && enterPressed === false) handleConfirm(); - }, [enterPressed]); - const handlePasswordStates = (index: number) => { setPasswordStates({ ...passwordStates, @@ -110,7 +105,11 @@ const InputDialog: React.FC = () => { size="xs" > - + { + if (e.key === 'Enter' && visible) return handleConfirm(); + }} + > {fields.heading} {fields.rows.map((row: IInput | ICheckbox | ISelect | INumber | ISlider, index) => (