feat: Improve Input accessibility with ARIA attributes
Add `aria-invalid` and `aria-describedby` attributes to Input and Textarea components when an error is present. This ensures screen readers announce the validation error when the input is focused. Also added unit tests for these accessibility attributes.
This commit is contained in:
3
.Jules/palette.md
Normal file
3
.Jules/palette.md
Normal file
@@ -0,0 +1,3 @@
|
||||
## 2024-05-24 - Accessible Input Validation
|
||||
**Learning:** React 19 renders `aria-invalid={false}` as `aria-invalid="false"`, unlike older versions which might have omitted it. Explicitly handling this in tests is crucial. Also, ensuring DOM cleanup (`cleanup()`) in `afterEach` is vital when testing similar components with same labels across tests to avoid "finding the wrong element" false positives/negatives.
|
||||
**Action:** Always include `afterEach(() => cleanup())` in `vitest` setup for DOM tests, and expect `aria-invalid="false"` (or explicitly handle `undefined` if omission is desired) when testing valid states in React 19.
|
||||
Reference in New Issue
Block a user