What a component tells assistive technology.
The protocol guide ("Catalog-Agnostic Accessibility Requirements")
asks catalogs and renderers to plumb the accessibility object of a
component — label, description, live, hidden — into the
platform's accessibility API, to infer sensible defaults from the
component's visible text, and to let explicit attributes override what
was inferred. attributes/2 computes exactly that, from the component
definition and the data it is bound to:
label— the explicitaccessibility.label, else the first non-empty string among the component'stitle,textandlabelproperties;description— the explicitaccessibility.description;live—"off","polite"or"assertive"("off"unless declared);hidden— whether the component (and so its subtree) is hidden from assistive technology;roleandchecked— for the basic catalog's interactive types: Button is a"button", TextField a"textbox", CheckBox a"checkbox"(with its state inchecked) and ChoicePicker a"radiogroup".
lint/1 is the catalog-side requirement: interactive components must
declare some way to label them.
iex> alias A2UICore.State.Component
iex> button = Component.new("go", "Button", %{
...> "title" => "Submit",
...> "accessibility" => %{"label" => "Send form", "live" => "polite"}
...> })
iex> {attributes, []} = A2UICore.Accessibility.attributes(button, A2UICore.Resolution.DataContext.new())
iex> {attributes.label, attributes.live, attributes.hidden, attributes.role}
{"Send form", "polite", false, "button"}
Summary
Functions
The accessibility attributes of component in context.
Checks a catalog against the requirement that components accepting actions or input bindings declare how they are labelled.
Types
A catalog component that cannot be labelled.
Functions
@spec attributes(A2UICore.State.Component.t(), A2UICore.Resolution.DataContext.t()) :: {attributes(), [A2UICore.Resolution.DataContext.effect()]}
The accessibility attributes of component in context.
Dynamic values ({"path": …} / {"@path": …} bindings, function
calls) are resolved against the context's data model; resolution
warnings come back as effects.
@spec lint(A2UICore.Catalog.t()) :: [finding()]
Checks a catalog against the requirement that components accepting actions or input bindings declare how they are labelled.
A component is interactive when one of its properties is an Action
or when it has a value property bound to a dynamic type. It is
labellable when it declares a label, title, text or child
property (required or not — an optional one is a fallback). Every
component carries accessibility from the component envelope, so an
explicit label is always possible; this checks that the catalog itself
gives the component a visible one to fall back on.
Returns a list of findings; an empty list means the catalog conforms.