Langage
Accessibility
Roles, names and states are part of the component contract, checked by dsfc and mapped to native controls.
The accessibility block
accessibility {
role = "checkbox"
name = prop.label
checked = prop.checked
disabled = prop.disabled
}
| Attribute | Meaning |
|---|---|
role |
A WAI-ARIA role name, such as button, checkbox, switch, tab; or a choice of non-interactive roles, such as variant.tone == "urgent" ? "alertdialog" : "dialog". |
name, labelled_by |
The accessible name, as a value or as nodes of the view (one, or a list in order). |
description, described_by |
Additional description; described_by = ["error", "hint"] reads the error first and skips it while it is absent. |
controls |
The nodes this element controls, such as the suggestions of a search box. |
active_descendant |
{ node = "option", key = state.active }: the highlighted repetition while focus stays on the element. |
autocomplete |
"none", "list", "inline" or "both". |
live |
On a text: "polite" or "assertive" announces it when it appears or changes. |
level, position, column_count, row_index, row_count, multiselectable, sort |
Positions and extents in headings, lists, trees and grids. |
checked |
A boolean, or "unchecked", "checked", "mixed". |
disabled, expanded, selected, invalid, required, hidden |
States. For checked, expanded and selected, null means the state does not apply. |
value |
The current value, for roles that have one. |
A single node can also be hidden from assistive technologies with
accessibility = "hidden".
On each target
Every member is applied with the platform’s own semantics or reported as DSF-X001, never
dropped. Angular uses ARIA 1.2 (aria-label, aria-labelledby, aria-describedby,
aria-expanded, aria-invalid, aria-required, native disabled state). SwiftUI uses
accessibility labels, hints, values and traits; it has no expanded, invalid or required
state, so those are exposed as accessibility custom content (reported as custom in the
capability report). value outside roles that have a value is DSF-X001 on Angular.
Angular also writes the grid, list, list box, tree and dialog roles with the states ARIA 1.2
gives them, aria-controls, aria-activedescendant and aria-autocomplete, and announces
live texts through a polite or assertive live region. SwiftUI announces live texts with
accessibility notifications, sets heading levels and links an element to those it controls.
It has no grid, list, tree or combobox role outside its own List and Table, so grids,
lists and trees are container elements whose cells and items combine their content, a
combobox is a text field whose popup state and list are custom content, and the active
descendant is announced; all of these are reported as custom.
What dsfc check verifies
| ID | Check |
|---|---|
DSF-A001 |
An interactive role (button, checkbox, switch, tab, textbox…) has a non-empty name or a labelled_by. |
DSF-A002 |
Every icon is either decorative = true or has a non-empty label. |
DSF-A004 |
labelled_by, described_by and other relationships name a node of the view. |
DSF-B003 |
Activation cannot run while the component is disabled. |
DSF-A003 |
Contrast of text and icons against their background (warning). |
Contrast
There is no list of color pairs to maintain: dsfc check derives them from what the views
paint. It resolves each component in its default configuration, each variant value, each
interaction state and each example, in every combination of the context axes the tokens
depend on (light and dark themes, for example), and compares each text and icon color with
the background painted behind it.
design-system.dsf:35:9: warning DSF-A003: text `label` of Hint: #9e9e9e on #ffffff is 2.68:1, below 4.5:1 (WCAG 2.2 SC 1.4.3); in Hint default configuration
- Thresholds are WCAG 2.2: 4.5:1 for text, 3:1 for large text and non-decorative icons.
- Disabled configurations are exempt, as WCAG allows for inactive components.
- Not covered yet: text over images or gradients, shapes drawn under text in overlays, and focus indicators. Nothing is checked over a background the compiler cannot determine.
Native mapping
Generators map roles to platform controls instead of re-creating them. A button role with
an activation handler becomes a SwiftUI.Button on macOS and a <button> in Angular, so
keyboard activation, disabled semantics and assistive-technology actions are native. The
tri-state checkbox becomes an <input type="checkbox"> with indeterminate in Angular. In
SwiftUI, which has no native tri-state checkbox, it is a button with the toggle trait and a
checked, unchecked or mixed value, reported as custom in the build report.
User preferences
Components read user preferences as context axes and never override them (DSF-N011):
override "reduced-motion" {
layer = "context"
when = context.reduced_motion
node "box" {
transitions = {
background = token.motion.instant
}
}
}
text_scale works the same way: geometry that follows the text can multiply by
context.text_scale.