Accessibility
LynxAccessibility speaks to screen readers from code, and the accessibility-* attributes describe elements to them. import { LynxAccessibility } from '@blotch/angular-lynx';
Usage
The screen reader is VoiceOver on iOS and TalkBack on Android.
API
LynxAccessibility
Imperative screen reader control, for changes that the attributes below can't express.
Lynx provides both methods only on the background thread. On the main thread, which runs your event handlers, both promises reject. See Threads.
LynxAccessibility.announce()
Makes the screen reader speak content without moving focus. Use it for results that don't move focus, such as "Saved" or a finished upload.
- Resolves once Lynx accepts the announcement.
- Rejects when Lynx's announce API isn't available.
LynxAccessibility.requestFocus()
Moves the screen reader's focus to the element that matches selector. Give that element accessibility-element="true".
selector: use an ID selector such as'#confirmation', which matches the element'sid. Other selectors aren't reliable.- Rejects with the Lynx error code when the element can't take focus, or when selector queries aren't available.
Attributes
Every Lynx element accepts these attributes. Set them as static attributes, or bind them with [attr.accessibility-label]="label()".
accessibility-traits takes one of 'text', 'image', 'button', 'link', 'header', 'search', 'selected', 'playable', 'keyboard', 'summary', 'disabled', 'updating', 'adjustable', 'tabbar' or 'none'.
accessibility-traits, plural
LYNX_ELEMENTS currently declares the input as accessibility-trait, singular, but Lynx reads only accessibility-traits. Use the plural as a static attribute or with [attr.accessibility-traits].
Types
None of its own.
Related
- Accessibility: labeling, grouping and focus traps.
- Elements: the other attributes every element accepts.
- Lynx accessibility docs
