mirror of
https://github.com/spartan-ng/spartan.git
synced 2026-09-22 16:41:38 +08:00
282a98f046
Update type annotation to be compatible with TypeScript's exactOptionalPropertyTypes option.
@spartan-ng/helm/field
Secondary entry point of @spartan-ng/helm. It can be used by importing from @spartan-ng/helm/field.
Accessibility helpers
The field package now exposes helpers to automatically wire aria-describedby from hlm-field-description and hlm-field-error instances. The BrnField directive provides the BrnFieldA11yService, hlm-field-description/hlm-field-error register unique IDs, and the brnFieldControlDescribedBy directive merges those IDs onto focusable controls. To support a new Helm control:
- Render the control inside an
hlmFieldcontainer. - Apply
brnFieldControlDescribedByon the focusable native element (or host directive for standalone input-like directives). - Let the description and error elements remain siblings inside the field; their IDs are generated automatically if you don't provide one.
- If you need to expose a custom
aria-describedby, the directive will merge it with the field-generated IDs.