Integrate LoginForm field-level validation display
epic-email-password-login-ui-task-004 — Wire inline field-level validation error display into LoginForm. On submission or field blur, show error messages directly beneath each field using AppTextField's errorText parameter. Error text must be announced as a live region for screen readers using Semantics(liveRegion: true). Errors must not rely solely on colour to convey meaning (WCAG 1.4.1).
Acceptance Criteria
Technical Requirements
Execution Context
Tier 2 - 518 tasks
Can start after Tier 1 completes
Implementation Notes
Maintain a Map
Wrap each AppTextField in a Column that includes a Semantics(liveRegion: true, child: Text(error)) widget — or confirm AppTextField already handles this internally; if not, add it externally. For WCAG 1.4.1, prefix each error string with an error icon character or 'Error: ' text so the message carries meaning independent of colour. Pristine tracking: use a Set
Testing Requirements
Write widget tests using flutter_test covering: (1) submitting empty form shows both error messages, (2) submitting with invalid email format shows email error only, (3) valid email + empty password shows password error only, (4) blurring email field with invalid content shows email error without requiring submit, (5) correcting a field after error clears the error text, (6) Semantics tree contains liveRegion: true nodes when errors are visible. Use find.bySemanticsLabel and tester.semantics to assert accessibility tree. Use flutter_test's SemanticsController to verify live region announcements.
Automated accessibility checks (e.g., flutter_accessibility_service) may pass while manual VoiceOver/TalkBack testing reveals focus-order issues, missing semantic roles, or live region announcements that fire too early or not at all. Discovering these late risks delaying the MVP release.
Mitigation & Contingency
Mitigation: Conduct manual VoiceOver and TalkBack testing on physical devices at the end of every sprint, not only at release. Define accessibility acceptance criteria per component and include them in the DoD. Use Semantics widgets explicitly rather than relying on implicit semantics from Flutter's default widgets for all interactive elements.
Contingency: Maintain a prioritized accessibility bug backlog separate from the main backlog. If critical VoiceOver issues are found close to release, create an explicit accessibility hotfix sprint before TestFlight distribution to Blindeforbundet testers.
Keyboard height varies significantly between iOS and Android, between device sizes (iPhone SE vs iPad), and with third-party keyboards. The KeyboardAwareLayout may not correctly adjust scroll offset in all combinations, causing input fields to remain hidden behind the keyboard on certain device/keyboard configurations.
Mitigation & Contingency
Mitigation: Test on a matrix of devices including iPhone SE (small viewport), a mid-size Android phone, and a tablet. Implement the layout using MediaQuery.viewInsets.bottom rather than a fixed padding value to correctly respond to any keyboard height. Include edge cases for floating keyboards on iPads.
Contingency: If device-specific issues are found after release, implement a bottom-padding fallback using BottomPadding inset and allow users to manually scroll. Log affected device/OS combinations for targeted fixes.
If the design token system's colour palette is updated without re-running contrast validation, form field labels, error messages, or placeholder text could fall below the WCAG 2.2 AA 4.5:1 ratio, causing a compliance regression.
Mitigation & Contingency
Mitigation: Integrate a contrast ratio validator (e.g., a CI lint step using the contrast-ratio-validator component) that checks all colour pairs used in the login form on every pull request. Document which token pairs are used for labels, errors, and backgrounds in the login form.
Contingency: If a contrast regression is detected post-merge, hot-patch the affected design token value. Do not ship a TestFlight build with known WCAG AA failures to Blindeforbundet testers.