feat: Complete form accessibility enhancement (WCAG 2.1 AA)
Some checks failed
CI/CD Pipeline / Lint and Test (push) Has been cancelled
CI/CD Pipeline / E2E Tests (push) Has been cancelled
CI/CD Pipeline / Build Application (push) Has been cancelled

Implemented comprehensive form accessibility improvements across all critical forms:

**Accessibility Attributes Added:**
- aria-required="true" on all required form fields
- aria-invalid on fields with validation errors
- aria-describedby linking error messages to inputs
- Unique id attributes on FormHelperText for error association
- role="alert" on error messages for screen reader announcements
- labelId on Select components for proper label association
- noValidate on forms to use custom validation

**Forms Updated:**
1. Login Form (app/(auth)/login/page.tsx)
   - Email and password fields with full ARIA support
   - Error message association with aria-describedby

2. Registration Form (app/(auth)/register/page.tsx)
   - All text fields: name, email, password, DOB, parental email
   - Checkbox fields: Terms, Privacy, COPPA consent
   - Conditional required fields for minors

3. Child Dialog (components/children/ChildDialog.tsx)
   - Name, birthdate, gender fields
   - Dynamic aria-invalid based on validation state

4. Tracking Forms:
   - Feeding form (app/track/feeding/page.tsx)
     - Child selector, side selector, bottle type
     - Food description with required validation
   - Sleep form (app/track/sleep/page.tsx)
     - Child selector, start/end time fields
     - Quality and location selectors

**WCAG 2.1 Compliance:**
-  3.3.2 Labels or Instructions (AA)
-  4.1.3 Status Messages (AA)
-  1.3.1 Info and Relationships (A)
-  3.3.1 Error Identification (A)

**Documentation:**
- Updated REMAINING_FEATURES.md
- Marked Form Accessibility Enhancement as complete
- Status: 79 features completed (57%)

🎉 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-10-04 13:24:40 +00:00
parent 2110359307
commit 4e5f1c849e
7 changed files with 231 additions and 43 deletions

View File

@@ -197,7 +197,7 @@ export default function LoginPage() {
</Alert>
)}
<Box component="form" onSubmit={handleSubmit(onSubmit)}>
<Box component="form" onSubmit={handleSubmit(onSubmit)} noValidate>
<TextField
fullWidth
label={t('login.email')}
@@ -207,10 +207,20 @@ export default function LoginPage() {
helperText={errors.email?.message}
{...register('email')}
disabled={isLoading}
inputProps={{ autoComplete: 'username' }}
required
inputProps={{
autoComplete: 'username',
'aria-required': 'true',
'aria-invalid': !!errors.email,
'aria-describedby': errors.email ? 'email-error' : undefined,
}}
InputProps={{
sx: { borderRadius: 3 },
}}
FormHelperTextProps={{
id: errors.email ? 'email-error' : undefined,
role: errors.email ? 'alert' : undefined,
}}
/>
<TextField
@@ -222,7 +232,13 @@ export default function LoginPage() {
helperText={errors.password?.message}
{...register('password')}
disabled={isLoading}
inputProps={{ autoComplete: 'current-password' }}
required
inputProps={{
autoComplete: 'current-password',
'aria-required': 'true',
'aria-invalid': !!errors.password,
'aria-describedby': errors.password ? 'password-error' : undefined,
}}
InputProps={{
sx: { borderRadius: 3 },
endAdornment: (
@@ -238,6 +254,10 @@ export default function LoginPage() {
</InputAdornment>
),
}}
FormHelperTextProps={{
id: errors.password ? 'password-error' : undefined,
role: errors.password ? 'alert' : undefined,
}}
/>
<Box sx={{ textAlign: 'right', mt: 1 }}>