improve keyboard navigation on create monitor page
This commit is contained in:
1 parent
79957693fe
commit
7b2358bd48
3 files changed
+23
-3
No files matched your search
@@ -42,6 +42,9 @@ export const RadioWithDescription = ({
|
|||||||
"& .MuiButtonBase-root": {
|
"& .MuiButtonBase-root": {
|
||||||
mr: theme.spacing(6),
|
mr: theme.spacing(6),
|
||||||
},
|
},
|
||||||
|
"&:has(.Mui-focusVisible)": {
|
||||||
|
backgroundColor: theme.palette.action.hover,
|
||||||
|
},
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -293,6 +293,9 @@ const CreateMonitorPage = () => {
|
|||||||
setCurrentStep((step) => step + 1);
|
setCurrentStep((step) => step + 1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const isWizardStep = !isEditMode && currentStep < totalSteps - 1;
|
||||||
|
|
||||||
const handleBack = () => setCurrentStep((step) => step - 1);
|
const handleBack = () => setCurrentStep((step) => step - 1);
|
||||||
|
|
||||||
// Reset the form when the monitor type changes so stale type-specific fields
|
// Reset the form when the monitor type changes so stale type-specific fields
|
||||||
@@ -362,6 +365,13 @@ const CreateMonitorPage = () => {
|
|||||||
logger.debug("Monitor creation validation errors", errors);
|
logger.debug("Monitor creation validation errors", errors);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleFormSubmit = isWizardStep
|
||||||
|
? (event: React.FormEvent) => {
|
||||||
|
event.preventDefault();
|
||||||
|
void handleNext();
|
||||||
|
}
|
||||||
|
: handleSubmit(onSubmit, onError);
|
||||||
|
|
||||||
const notificationOptions = useMemo(() => {
|
const notificationOptions = useMemo(() => {
|
||||||
return (notifications ?? []).map((n) => ({
|
return (notifications ?? []).map((n) => ({
|
||||||
...n,
|
...n,
|
||||||
@@ -461,7 +471,7 @@ const CreateMonitorPage = () => {
|
|||||||
<FormProvider {...form}>
|
<FormProvider {...form}>
|
||||||
<BasePage
|
<BasePage
|
||||||
component="form"
|
component="form"
|
||||||
onSubmit={handleSubmit(onSubmit, onError)}
|
onSubmit={handleFormSubmit}
|
||||||
>
|
>
|
||||||
<HeaderDeleteControls
|
<HeaderDeleteControls
|
||||||
monitor={existingMonitor}
|
monitor={existingMonitor}
|
||||||
@@ -909,10 +919,9 @@ const CreateMonitorPage = () => {
|
|||||||
{!isEditMode && currentStep < totalSteps - 1 ? (
|
{!isEditMode && currentStep < totalSteps - 1 ? (
|
||||||
<Button
|
<Button
|
||||||
key="wizard-next"
|
key="wizard-next"
|
||||||
type="button"
|
type="submit"
|
||||||
variant="contained"
|
variant="contained"
|
||||||
color="primary"
|
color="primary"
|
||||||
onClick={handleNext}
|
|
||||||
>
|
>
|
||||||
{t("common.buttons.next")}
|
{t("common.buttons.next")}
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -124,6 +124,14 @@ export const theme = (mode: string, palette: any) =>
|
|||||||
disableTouchRipple: true,
|
disableTouchRipple: true,
|
||||||
disableFocusRipple: true,
|
disableFocusRipple: true,
|
||||||
},
|
},
|
||||||
|
styleOverrides: {
|
||||||
|
root: ({ theme }) => ({
|
||||||
|
"&.Mui-focusVisible": {
|
||||||
|
outline: `1px solid ${theme.palette.primary.main}`,
|
||||||
|
outlineOffset: 2,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
MuiIconButton: {
|
MuiIconButton: {
|
||||||
defaultProps: {
|
defaultProps: {
|
||||||
|
|||||||
Reference in new issue
Block a user