Skip to content

Commit 0880949

Browse files
committed
Added aria attributes for signup-form error state
no issue - improves markup for assistive tech
1 parent fe54b07 commit 0880949

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

apps/signup-form/src/components/pages/form-view.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export const FormView: React.FC<FormProps & {
3030
{description && <p className='mb-4 text-center font-medium md:mb-5'>{description}</p>}
3131
<div className='relative w-full max-w-[440px]'>
3232
<Form error={error} {...formProps} />
33-
<p className={`h-5 w-full text-left text-red-500 ${error ? 'visible' : 'invisible'}`} data-testid="error-message">{error}</p>
33+
<p className={`h-5 w-full text-left text-red-500 ${error ? 'visible' : 'invisible'}`} data-testid="error-message" id="error-message">{error}</p>
3434
</div>
3535

3636
</div>
@@ -61,6 +61,8 @@ const Form: React.FC<FormProps> = ({isMinimal, loading, success, error, buttonCo
6161
<>
6262
<form className={`relative flex w-full rounded-[.5rem] border bg-white p-[3px] text-grey-900 transition hover:border-grey-400 focus-visible:border-grey-500 ${error ? '!border-red-500' : 'border-grey-300'}`} noValidate={true} onSubmit={submitHandler}>
6363
<input
64+
aria-describedby={error ? 'error-message' : undefined}
65+
aria-invalid={error ? 'true' : 'false'}
6466
className={`w-full px-2 py-1 focus-visible:outline-none disabled:bg-white xs:p-2`}
6567
data-testid="input"
6668
disabled={loading || success}

0 commit comments

Comments
 (0)