improve keyboard navigation on create monitor page

This commit is contained in:
Alex Holliday committed 2026-08-19 11:28:46 -07:00
1 parent 79957693fe
commit 7b2358bd48
3 files changed
+23 -3

No files matched your search

+12 -3
View File
@@ -293,6 +293,9 @@ const CreateMonitorPage = () => {
setCurrentStep((step) => step + 1);
}
};
const isWizardStep = !isEditMode && currentStep < totalSteps - 1;
const handleBack = () => setCurrentStep((step) => step - 1);
// 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);
};
const handleFormSubmit = isWizardStep
? (event: React.FormEvent) => {
event.preventDefault();
void handleNext();
}
: handleSubmit(onSubmit, onError);
const notificationOptions = useMemo(() => {
return (notifications ?? []).map((n) => ({
...n,
@@ -461,7 +471,7 @@ const CreateMonitorPage = () => {
<FormProvider {...form}>
<BasePage
component="form"
onSubmit={handleSubmit(onSubmit, onError)}
onSubmit={handleFormSubmit}
>
<HeaderDeleteControls
monitor={existingMonitor}
@@ -909,10 +919,9 @@ const CreateMonitorPage = () => {
{!isEditMode && currentStep < totalSteps - 1 ? (
<Button
key="wizard-next"
type="button"
type="submit"
variant="contained"
color="primary"
onClick={handleNext}
>
{t("common.buttons.next")}
</Button>