FS FormScript
Package@formscript/a11y
Specification13, 13.3
Depends onast, types

@formscript/a11y

Accessibility metadata, per §13 of the specification.

The requirements

Fifteen requirements, each traced to the section of the specification that states it:

ts
import { A11Y_REQUIREMENTS } from '@formscript/a11y';

for (const requirement of A11Y_REQUIREMENTS) {
  requirement.id;        // 'a11y-3'
  requirement.section;   // '§13.3'
  requirement.text;
}

The accessible tree

buildAccessibleTree turns a document into the tree a screen reader needs: each field with its role, its accessible name, its description, and the relationships between them.

The error summary

The error summary is part of the contract, not a convenience: it must exist, it must be reachable from the first invalid field, and it must list the errors in document order. buildErrorSummary produces it.

Public API

35 exported symbols.

A11Y_REQUIREMENTS re-export
A11yCheckOptions interface
A11yRequirement interface
A11yRequirementId type
A11yViolation interface
AccessibleNode interface
AccessibleOption interface
AccessibleRole type
AccessibleTreeOptions interface
buildAccessibleTree re-export
buildCatalogue function
buildErrorSummary re-export
checkA11y re-export
CHOICE_SELECT_THRESHOLD re-export
collectEntities function

The entities of the form body; namespace bodies belong to other documents (§4.4).

Entity interface
EntityKind type
ERROR_SUMMARY_ID re-export
ErrorSummary interface
ErrorSummaryEntry interface
ErrorSummaryOptions interface
FieldError interface
findAccessibleNode re-export
flattenEntities function
flattenRenderable function

Every entity that renders, in document order; a `state` subtree renders nothing (§7.1).

isDataBearing function
isRenderable function

A `state` declaration is not an entity and renders nothing (§7.1).

OptionSpec interface
readOptions function
RepeatInfo interface
resolveBoolean function
resolveCatalogueValue function

Locale fallback chain of §12.4: exact locale, language only, `default`.

resolveNumber function
resolveText function

`undefined` means the text is not statically resolvable; `''` means it resolves to nothing.

TextCatalogue interface