diff --git a/src/components/MyAccount/Settings/PasswordForm.tsx b/src/components/MyAccount/Settings/PasswordForm.tsx index eb5dc17d..dab180bd 100644 --- a/src/components/MyAccount/Settings/PasswordForm.tsx +++ b/src/components/MyAccount/Settings/PasswordForm.tsx @@ -81,12 +81,21 @@ const PasswordForm = ({ patronData, settingsState }: PasswordFormProps) => { const cancelEditing = () => { setIsEditing(false) + clearForm() setEditingField("") setTimeout(() => { editingRef.current?.focus() }, 0) } + const clearForm = () => { + setFormData({ + currentPassword: "", + newPassword: "", + confirmPassword: "", + passwordsMatch: true, + }) + } const validateForm = formData.currentPassword !== "" && formData.newPassword !== "" && @@ -146,6 +155,7 @@ const PasswordForm = ({ patronData, settingsState }: PasswordFormProps) => { console.error("Error submitting", error) } finally { setIsLoading(false) + clearForm() setEditingField("") } } diff --git a/src/components/MyAccount/Settings/SettingsSelectForm.tsx b/src/components/MyAccount/Settings/SettingsSelectForm.tsx index e8283b52..cf90e6b6 100644 --- a/src/components/MyAccount/Settings/SettingsSelectForm.tsx +++ b/src/components/MyAccount/Settings/SettingsSelectForm.tsx @@ -190,50 +190,52 @@ const SettingsSelectForm = ({ ) : ( - - - - {selection} - - {isNotification && - patronHasNonePref && - !patronHasPhone && - !patronHasEmail && ( - - )} + + + + + {selection} + + + {editingField === "" && ( + { + setIsEditing(true) + setEditingField(type) + setTimeout(() => { + selectRef.current?.focus() + }, 0) + }} + /> + )} - {editingField === "" && ( - { - setIsEditing(true) - setEditingField(type) - setTimeout(() => { - selectRef.current?.focus() - }, 0) - }} - /> - )} + {isNotification && + patronHasNonePref && + !patronHasPhone && + !patronHasEmail && ( + + )} )} {isEditing && (