dont close dialog if clicking outside, also fix warning https://w3c.github.io/aria/#aria-hidden

This commit is contained in:
proddy
2024-07-20 11:44:18 +02:00
parent a0ba0e8af9
commit ac27096087
6 changed files with 38 additions and 26 deletions

View File

@@ -64,8 +64,10 @@ const CustomEntitiesDialog = ({
}
}, [open, selectedItem]);
const close = () => {
onClose();
const handleClose = (event: {}, reason: 'backdropClick' | 'escapeKeyDown') => {
if (reason !== 'backdropClick') {
onClose();
}
};
const save = async () => {
@@ -90,7 +92,7 @@ const CustomEntitiesDialog = ({
};
return (
<Dialog sx={dialogStyle} open={open} onClose={close}>
<Dialog sx={dialogStyle} open={open} onClose={handleClose}>
<DialogTitle>
{creating ? LL.ADD(1) + ' ' + LL.NEW(1) : LL.EDIT()}&nbsp;{LL.ENTITY()}
</DialogTitle>
@@ -314,7 +316,7 @@ const CustomEntitiesDialog = ({
<Button
startIcon={<CancelIcon />}
variant="outlined"
onClick={close}
onClick={onClose}
color="secondary"
>
{LL.CANCEL()}

View File

@@ -54,8 +54,10 @@ const CustomizationDialog = ({
}
}, [open, selectedItem]);
const close = () => {
onClose();
const handleClose = (event: {}, reason: 'backdropClick' | 'escapeKeyDown') => {
if (reason !== 'backdropClick') {
onClose();
}
};
const save = () => {
@@ -76,7 +78,7 @@ const CustomizationDialog = ({
};
return (
<Dialog sx={dialogStyle} open={open} onClose={close}>
<Dialog sx={dialogStyle} open={open} onClose={handleClose}>
<DialogTitle>{LL.EDIT() + ' ' + LL.ENTITY()}</DialogTitle>
<DialogContent dividers>
<Grid container direction="row">
@@ -115,7 +117,7 @@ const CustomizationDialog = ({
name="cn"
label={LL.NEW_NAME_OF(LL.ENTITY())}
value={editItem.cn}
autoFocus
// autoFocus
sx={{ width: '30ch' }}
onChange={updateFormValue}
/>
@@ -155,7 +157,7 @@ const CustomizationDialog = ({
<Button
startIcon={<CancelIcon />}
variant="outlined"
onClick={close}
onClick={onClose}
color="secondary"
>
{LL.CANCEL()}

View File

@@ -120,7 +120,7 @@ const DevicesDialog = ({
label={LL.VALUE(0)}
value={editItem.v}
disabled={!writeable}
autoFocus
// autoFocus
sx={{ width: '30ch' }}
select
onChange={updateFormValue}
@@ -162,7 +162,7 @@ const DevicesDialog = ({
label={LL.VALUE(0)}
value={editItem.v}
disabled={!writeable}
autoFocus
// autoFocus
sx={{ width: '30ch' }}
multiline={editItem.u ? false : true}
onChange={updateFormValue}

View File

@@ -62,10 +62,6 @@ const SchedulerDialog = ({
}
}, [open, selectedItem]);
const close = () => {
onClose();
};
const save = async () => {
try {
setFieldErrors(undefined);
@@ -151,8 +147,14 @@ const SchedulerDialog = ({
</Typography>
);
const handleClose = (event: {}, reason: 'backdropClick' | 'escapeKeyDown') => {
if (reason !== 'backdropClick') {
onClose();
}
};
return (
<Dialog sx={dialogStyle} open={open} onClose={close}>
<Dialog sx={dialogStyle} open={open} onClose={handleClose}>
<DialogTitle>
{creating ? LL.ADD(1) + ' ' + LL.NEW(0) : LL.EDIT()}&nbsp;
{LL.SCHEDULE(1)}
@@ -294,6 +296,7 @@ const SchedulerDialog = ({
<TextField
name="time"
label={isCondition ? 'Condition' : 'On Change Value'}
multiline
fullWidth
value={
editItem.time == '00:00' ? (editItem.time = '') : editItem.time
@@ -327,6 +330,7 @@ const SchedulerDialog = ({
fieldErrors={fieldErrors}
name="cmd"
label={LL.COMMAND(0)}
multiline
fullWidth
value={editItem.cmd}
margin="normal"
@@ -369,7 +373,7 @@ const SchedulerDialog = ({
<Button
startIcon={<CancelIcon />}
variant="outlined"
onClick={close}
onClick={onClose}
color="secondary"
>
{LL.CANCEL()}

View File

@@ -57,8 +57,10 @@ const SensorsAnalogDialog = ({
}
}, [open, selectedItem]);
const close = () => {
onClose();
const handleClose = (event: {}, reason: 'backdropClick' | 'escapeKeyDown') => {
if (reason !== 'backdropClick') {
onClose();
}
};
const save = async () => {
@@ -77,7 +79,7 @@ const SensorsAnalogDialog = ({
};
return (
<Dialog sx={dialogStyle} open={open} onClose={close}>
<Dialog sx={dialogStyle} open={open} onClose={handleClose}>
<DialogTitle>
{creating ? LL.ADD(1) + ' ' + LL.NEW(0) : LL.EDIT()}&nbsp;
{LL.ANALOG_SENSOR(0)}
@@ -318,7 +320,7 @@ const SensorsAnalogDialog = ({
<Button
startIcon={<CancelIcon />}
variant="outlined"
onClick={close}
onClick={onClose}
color="secondary"
>
{LL.CANCEL()}

View File

@@ -52,8 +52,10 @@ const SensorsTemperatureDialog = ({
}
}, [open, selectedItem]);
const close = () => {
onClose();
const handleClose = (event: {}, reason: 'backdropClick' | 'escapeKeyDown') => {
if (reason !== 'backdropClick') {
onClose();
}
};
const save = async () => {
@@ -67,7 +69,7 @@ const SensorsTemperatureDialog = ({
};
return (
<Dialog sx={dialogStyle} open={open} onClose={close}>
<Dialog sx={dialogStyle} open={open} onClose={handleClose}>
<DialogTitle>
{LL.EDIT()}&nbsp;{LL.TEMP_SENSOR()}
</DialogTitle>
@@ -84,7 +86,7 @@ const SensorsTemperatureDialog = ({
name="n"
label={LL.NAME(0)}
value={editItem.n}
autoFocus
// autoFocus
sx={{ width: '30ch' }}
onChange={updateFormValue}
/>
@@ -110,7 +112,7 @@ const SensorsTemperatureDialog = ({
<Button
startIcon={<CancelIcon />}
variant="outlined"
onClick={close}
onClick={onClose}
color="secondary"
>
{LL.CANCEL()}