mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-06-25 16:19:19 +02:00
Add field-level aria-errormessage, aria-invalid, and aria-describedby across the TFE form
WCAG 3.3.1 (Error Identification): failing fields now get aria-errormessage pointing to the flash-error container and aria-invalid="true". WCAG 3.3.3 (Error Suggestion): <small> hint text on inputs, selects, and file fields is now linked via aria-describedby (always, not just on error). Changes: - text-field.php, select-field.php, checkbox-list.php: accept $errorFieldName; add aria-errormessage/aria-invalid on match; add id to <small> and aria-describedby on the control - fieldset-tfe-info.php: aria-invalid on synopsis textarea - fichiers-fragment.php: aria-describedby on cover, note d'intention, TFE, annexes, and website inputs; aria-invalid on format checkboxes when error matches 'formats' - form.php: id="flash-error" + tabindex="-1" on flash-error div; accept $errorFieldName from callers - admin/add.php: set $errorFieldName, wire $withAutofocusFn (was identity default) - admin/edit.php: set $errorFieldName - partage/index.php: consume autofocus field, wire autofocus function, add App::flashAutofocus() in submit catch block Also fixes WCAG standards issue: removed invalid 'required' HTML attribute from <fieldset> elements in checkbox-list.php and fichiers-fragment.php (only aria-required stays). Added role="group" for explicit ARIA semantics.
This commit is contained in:
20
TODO.md
20
TODO.md
@@ -35,10 +35,16 @@ Reference: Assessment against progressive-enhancement / WCAG-AA / "never lose da
|
||||
**Current state:** Flash error divs have `role="alert"` but individual fields are never linked to their error via `aria-errormessage`. The `autofocusFieldForError()` mechanism focuses the field after a validation redirect but does not announce the error to screen readers. Help `<small>` text is not linked via `aria-describedby`.
|
||||
|
||||
**To do:**
|
||||
- [ ] Extend `text-field.php`, `select-field.php`, `checkbox-list.php` partials to accept optional `$error` and `$errorId` variables
|
||||
- [ ] When `$error` is set, add `aria-errormessage="$errorId"` and `aria-invalid="true"` on the input
|
||||
- [ ] On validation redirect, populate per-field error IDs so each failing field references the flash error container
|
||||
- [ ] Add `aria-describedby` linking each `<small>` hint to its input (always, not just on error)
|
||||
- [x] Extend `text-field.php`, `select-field.php`, `checkbox-list.php` partials to accept optional `$errorFieldName` variable
|
||||
- [x] When `$errorFieldName` matches the field, add `aria-errormessage="flash-error"` and `aria-invalid="true"` on the input
|
||||
- [x] On validation redirect, populate `$errorFieldName` from `App::consumeAutofocus()` so each failing field references the flash error container
|
||||
- [x] Add `aria-describedby` linking each `<small>` hint to its input (always, not just on error)
|
||||
- [x] Give flash-error div `id="flash-error"` and `tabindex="-1"` for programmatic reference
|
||||
- [x] Wire `App::flashAutofocus()` into partage submit catch block (was missing)
|
||||
- [x] Wire `$withAutofocusFn` in admin add template (was defaulting to identity)
|
||||
- [x] Apply `aria-invalid` + `aria-errormessage` on synopsis textarea (not in text-field partial)
|
||||
- [x] Apply `aria-describedby` on file inputs in `fichiers-fragment.php`
|
||||
- [x] Apply format checkboxes `aria-invalid` support in `fichiers-fragment.php`
|
||||
- [ ] Test with VoiceOver and NVDA on the full add/edit/partage form flows
|
||||
|
||||
### 2. No-JS file uploads silently fail (data loss)
|
||||
@@ -103,9 +109,9 @@ Reference: Assessment against progressive-enhancement / WCAG-AA / "never lose da
|
||||
**Current state:** `checkbox-list.php` and `fichiers-fragment.php` put `required aria-required="true"` on `<fieldset>` elements. The `required` attribute is not valid on `<fieldset>`. Screen readers may not interpret this correctly.
|
||||
|
||||
**To do:**
|
||||
- [ ] Move `required` + `aria-required` to individual checkboxes inside the group
|
||||
- [ ] For checkbox groups (languages, formats): mark at least one checkbox as `required`, keep `aria-required="true"` on the fieldset (without the HTML `required` attribute)
|
||||
- [ ] Add `role="group"` on the fieldset for explicit ARIA semantics
|
||||
- [x] Remove `required` attribute from `<fieldset>` in `checkbox-list.php` — keep `aria-required="true"` only
|
||||
- [x] Remove `required` attribute from `<fieldset>` in `fichiers-fragment.php` — keep `aria-required="true"` only
|
||||
- [x] Add `role="group"` on both `<fieldset>` elements for explicit ARIA semantics
|
||||
|
||||
### 9. Refactor partage form page wrapper to a template
|
||||
|
||||
|
||||
Reference in New Issue
Block a user