Machine state, sequences and sessions
Terminal <smart-terminal>
Terminal displays a stream of lines, such as an instrument session or an event log, at a high rate.
Accessibility Attributes
The Terminal is a live log. Its lines arrive faster than a screen reader can follow, so the component is silent by default, rate-limited when announcements are enabled, and can be focused so that the log can be scrolled and read at the user's own pace.
The following ARIA attributes are used inside the Terminal:
- role="log" - set on the output. A log is the correct role for a running list of entries where new ones are appended and older ones scroll away.
- aria-live="off" by default - deliberate, and the most important decision in this component. A log region that speaks every line makes a busy plant screen unusable with a reader running. Set announce to turn it on.
- aria-live="polite" when announcing - and even then rate limited: an error interrupts, everything else is announced at most once every few seconds through the shared announcer, so several instruments on one screen cannot talk over each other.
- aria-label - names the log, so a reader landing in it knows which session it is.
- tabindex="0" on the output - the log itself can be focused and scrolled with the keyboard. A scrollable region that cannot be reached without a pointer is not readable by a keyboard user.
- aria-label on the command line - names the input, which otherwise announces only as an unlabelled text field.
- aria-hidden="true" on the prompt - the prompt is decoration; the input’s own label carries the meaning.
Keyboard Interaction
The following keyboard shortcuts are available to interact with the Terminal:
| Key | Action |
|---|---|
| Tab | Moves to the log, then to the command line when the terminal is interactive. |
| Arrow keys, Page Up / Page Down, Home / End | Scrolls the log once it has focus, using the browser's own scrolling. Scrolling away from the bottom stops the view from following new lines, so the reader's position is kept. |
| Enter | Sends the command on the command line, echoing it into the log as a transcript. |
Auto-scroll yielding to the operator matters more for keyboard and screen-reader users than for anyone else: a view that jumps to the end every time a line arrives is one they cannot read at all.
Localization
All strings the Terminal exposes to assistive technology come from its messages property, so they can be provided in the user's language. Set locale to select a language and add a language through messages. Assigning messages replaces the whole object, so include the existing languages when adding one: el.messages = Object.assign({}, el.messages, { de: pack }); If the built-in en pack is dropped, switching back to English shows raw message keys.
The Terminal uses the following message keys:
- terminalLabel
- inputLabel
- paused
- linesHidden
Additional information on WAI-ARIA for the SMART Framework can be found here.