mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-17 06:56:03 +01:00
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
This commit is contained in:
@@ -61,13 +61,8 @@ const InputDialog: React.FC = () => {
|
||||
>([]);
|
||||
const [passwordStates, setPasswordStates] = React.useState<boolean[]>([]);
|
||||
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"
|
||||
>
|
||||
<ModalOverlay />
|
||||
<ModalContent>
|
||||
<ModalContent
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === 'Enter' && visible) return handleConfirm();
|
||||
}}
|
||||
>
|
||||
<ModalHeader textAlign="center">{fields.heading}</ModalHeader>
|
||||
<ModalBody fontFamily="Poppins" textAlign="left">
|
||||
{fields.rows.map((row: IInput | ICheckbox | ISelect | INumber | ISlider, index) => (
|
||||
|
||||
Reference in New Issue
Block a user