# Accessibility

> For AI: what Dynamic UI components already do for accessibility, and what the widget still has to provide. The validator checks only the basics (*Accessibility* rules, warnings): see `modyo://docs/widgets/reference-validator-rules`.

---

## Accessible names

Every control needs a name a screen reader can announce.

| Element | How it gets its name |
|---------|----------------------|
| Inputs (`DInput`, `DInputSearch`, `DInputCurrency`, …) | `label`. Without a visible label, `aria-label` (forwarded to the `<input>`) |
| `DInputCheck`, `DInputSwitch`, `DInputRange`, `DInputSelect`, `DSelect` | `label`, or `ariaLabel` |
| `DDatePicker` | `inputLabel`, or `inputAriaLabel` |
| A clickable icon inside an input | `iconStartAriaLabel` / `iconEndAriaLabel` |
| `DButton` with text | Its `text` |
| An icon-only button | `DButtonIcon` plus `aria-label` |
| `DModal`, `DOffcanvas` | The title in the header, or `ariaLabel` when there is no visible title |
| `DListGroup`, `DTabs` | `ariaLabel` or `ariaLabelledBy` |
| `DProgress`, `DSkeleton` | `ariaLabel` (and `ariaLabelledBy` on `DProgress`) |

All visible text, names included, comes from `t('...')`.

## Icons

`DIcon` is hidden from screen readers by default (`ariaHidden` defaults to `true`), because an icon usually sits next to a visible label or inside a control with its own name. When an icon is the only carrier of meaning (a status without text), give it `ariaLabel`.

## Dialogs

`DModal` and `DOffcanvas` are announced as modal dialogs. Focus moves into the dialog when it opens, and elements that cannot receive focus are left out of the focus cycle. Give each dialog a visible title or `ariaLabel`.

## Live messages

`DAlert` and `DToast` take a `role`:

| `role` | Use |
|--------|-----|
| `alert` (default) | Interrupts the screen reader: critical errors |
| `status` | Announces without interrupting: dynamic, non-critical messages (a saved change) |
| `none` | No announcement: static content already on screen |

## Forms

- Show validation errors with `invalid` + `hint` on the field, so the message stays tied to it.
- Keep the visual order of fields equal to the tab order.
- Use `<form>` with a submit `DButton` (`type="submit"`) so Enter submits.

## Images

Every `<img>` has `alt` (empty `alt=""` for decorative images). Images are served from the site or a CDN and referenced by URL: the template's build must not contain files other than `main.js`, `main.css` and `index.html`.

## What the validator checks

| Rule | Checks |
|------|--------|
| *Inputs Have Labels* | Each `<DInput` has `label`, `aria-label` or `labelIcon` |
| *Buttons Have Text* | Each `<DButton` with an icon has `text`, `aria-label` or children |
| *Images Have Alt* | Each `<img` has `alt` |

They are warnings and cover only those three cases. Contrast, focus order, keyboard use and screen-reader behavior need a manual review.
