Skip to content

Commit

Permalink
fix: review
Browse files Browse the repository at this point in the history
  • Loading branch information
dougfabris committed Sep 19, 2023
1 parent 1dd9a31 commit 1973ae8
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions packages/web-ui-registration/src/LoginForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,15 @@ export const LoginForm = ({ setLoginRoute }: { setLoginRoute: DispatchLoginRoute
if (loginFormRef.current) {
loginFormRef.current.focus();
}
}, [errorOnSubmit]);
}, []);

const renderErrorOnSubmit = (error: LoginErrors) => {
const { type, i18n } = LOGIN_SUBMIT_ERRORS[error];
return <Callout type={type}>{t(i18n)}</Callout>;
return (
<Callout id={`${usernameId}-error`} aria-live='assertive' type={type}>
{t(i18n)}
</Callout>
);
};

if (errors.username?.type === 'invalid-email') {
Expand Down Expand Up @@ -177,11 +181,7 @@ export const LoginForm = ({ setLoginRoute }: { setLoginRoute: DispatchLoginRoute
)}
</Field>
</FieldGroup>
{errorOnSubmit && (
<FieldGroup disabled={loginMutation.isLoading} id={`${usernameId}-error`} aria-live='assertive'>
{renderErrorOnSubmit(errorOnSubmit)}
</FieldGroup>
)}
{errorOnSubmit && <FieldGroup disabled={loginMutation.isLoading}>{renderErrorOnSubmit(errorOnSubmit)}</FieldGroup>}
</Form.Container>
<Form.Footer>
<ButtonGroup stretch>
Expand Down

0 comments on commit 1973ae8

Please sign in to comment.