- {
- // Swallow clicks if the state is pending.
- // We do this instead of disabling the button to prevent
- // it from losing focus (disabled elements cannot have focus).
- // Disabling it would causes upstream issues in focus management.
- // Swallowing the onSubmit event on the form would be better, but
- // we would have to add that logic for every field given our
- // current structure of the application.
- if (saveState === 'pending') { e.preventDefault(); }
- }}
- disabledStates={[]}
- data-testid="editable-field-save"
- />
-
-
+ {
+ // Swallow clicks if the state is pending.
+ // We do this instead of disabling the button to prevent
+ // it from losing focus (disabled elements cannot have focus).
+ // Disabling it would causes upstream issues in focus management.
+ // Swallowing the onSubmit event on the form would be better, but
+ // we would have to add that logic for every field given our
+ // current structure of the application.
+ if (saveState === 'pending') { e.preventDefault(); }
+ }}
+ disabledStates={[]}
+ data-testid="editable-field-save"
+ />
+
+
- {
- // Swallow clicks if the state is pending.
- // We do this instead of disabling the button to prevent
- // it from losing focus (disabled elements cannot have focus).
- // Disabling it would causes upstream issues in focus management.
- // Swallowing the onSubmit event on the form would be better, but
- // we would have to add that logic for every field given our
- // current structure of the application.
- if (saveState === 'pending') { e.preventDefault(); }
- }}
- disabledStates={[]}
- />
-
-
+ {
+ // Swallow clicks if the state is pending.
+ // We do this instead of disabling the button to prevent
+ // it from losing focus (disabled elements cannot have focus).
+ // Disabling it would causes upstream issues in focus management.
+ // Swallowing the onSubmit event on the form would be better, but
+ // we would have to add that logic for every field given our
+ // current structure of the application.
+ if (saveState === 'pending') { e.preventDefault(); }
+ }}
+ disabledStates={[]}
+ />
+
+
- {
- // Swallow clicks if the state is pending.
- // We do this instead of disabling the button to prevent
- // it from losing focus (disabled elements cannot have focus).
- // Disabling it would causes upstream issues in focus management.
- // Swallowing the onSubmit event on the form would be better, but
- // we would have to add that logic for every field given our
- // current structure of the application.
- if (saveState === 'pending') { e.preventDefault(); }
- }}
- disabledStates={[]}
+
+
+
+
+ {label}
+
+ {!!helpText && {helpText}}
+ {error != null && {error}}
+
+
+ {
+ // Swallow clicks if the state is pending.
+ // We do this instead of disabling the button to prevent
+ // it from losing focus (disabled elements cannot have focus).
+ // Disabling it would causes upstream issues in focus management.
+ // Swallowing the onSubmit event on the form would be better, but
+ // we would have to add that logic for every field given our
+ // current structure of the application.
+ if (saveState === 'pending') { e.preventDefault(); }
+ }}
+ disabledStates={[]}
+ />
+
+
- {
- // Swallow clicks if the state is pending.
- // We do this instead of disabling the button to prevent
- // it from losing focus (disabled elements cannot have focus).
- // Disabling it would causes upstream issues in focus management.
- // Swallowing the onSubmit event on the form would be better, but
- // we would have to add that logic for every field given our
- // current structure of the application.
- if (status === 'pending') {
- e.preventDefault();
- }
- props.resetPassword(email);
- }}
- disabledStates={[]}
- labels={{
- default: intl.formatMessage(messages['account.settings.editable.field.password.reset.button']),
- }}
- />
-
+
+
+ )}
+ />
+
+
+ {
+ // Swallow clicks if the state is pending.
+ // We do this instead of disabling the button to prevent
+ // it from losing focus (disabled elements cannot have focus).
+ // Disabling it would causes upstream issues in focus management.
+ // Swallowing the onSubmit event on the form would be better, but
+ // we would have to add that logic for every field given our
+ // current structure of the application.
+ if (status === 'pending') {
+ e.preventDefault();
+ }
+ props.resetPassword(email);
+ }}
+ disabledStates={[]}
+ labels={{
+ default: intl.formatMessage(messages['account.settings.editable.field.password.reset.button']),
+ }}
+ />
+
+ {status && (
+
+ {status === 'complete' ? : null}
+ {status === 'forbidden' ? : null}
+
+ )}
+
+
);
};
diff --git a/src/account-settings/test/__snapshots__/EditableSelectField.test.jsx.snap b/src/account-settings/test/__snapshots__/EditableSelectField.test.jsx.snap
index dc26695a0..28853054d 100644
--- a/src/account-settings/test/__snapshots__/EditableSelectField.test.jsx.snap
+++ b/src/account-settings/test/__snapshots__/EditableSelectField.test.jsx.snap
@@ -2,68 +2,97 @@
exports[`EditableSelectField renders EditableSelectField correctly with editing disabled 1`] = `
`;
exports[`EditableSelectField renders EditableSelectField with an error 1`] = `
-
- Main Label
-
-
+
+
+ Test Field
+
+
+
+
-
- Edit
-
+
+
+
-
- Test Field
-
-
- Default Confirmation Message
-
+
+
+ Default Confirmation Message
+
+
+
@@ -277,68 +349,97 @@ exports[`EditableSelectField renders EditableSelectField with an error 1`] = `
exports[`EditableSelectField renders selectOptions when option does not have a group 1`] = `
-
- Main Label
-
-
+
+
+ Test Field
+
+
+
+
-
- Edit
-
+
+
+
-
- Test Field
-
-
- Default Confirmation Message
-
+
+
+ Default Confirmation Message
+
+
+
@@ -346,68 +447,97 @@ exports[`EditableSelectField renders selectOptions when option does not have a g
exports[`EditableSelectField renders selectOptions when option has a group 1`] = `
-
- Main Label
-
-
+
+
+ Test Field
+
+
+
+
-
- Edit
-
+
+
+
-
- Test Field
-
-
- Default Confirmation Message
-
+
+
+ Default Confirmation Message
+
+
+
@@ -415,68 +545,97 @@ exports[`EditableSelectField renders selectOptions when option has a group 1`] =
exports[`EditableSelectField renders selectOptions with multiple groups 1`] = `