Instrument readouts and controls
Momentary Button <smart-momentary-button>
MomentaryButton is an operator button with three action modes.
Accessibility Attributes
The MomentaryButton is a button. Its accessible name contains the label, the action mode and the state reported by the plant, for example "Start, hold for 1 s, stopped", so a screen reader user knows before pressing that the key has to be held, and hears the device state without relying on colour. An interlock is included in the name and, when the button is pressed anyway, announced as an assertive message with the reason. A completed hold and a confirmed press are announced through the label, because the button does not change in a way a screen reader could report.
The following ARIA attributes are used inside the MomentaryButton:
- <button> - the control is a native button, so it is focusable, has the button role, and receives Space and Enter without any script. Its text is the label.
- aria-label - set on the button: the label, then ", hold for N s" or ", press twice" for the hold and confirm disciplines, then ", <state>" when the plant reports one, then ", interlocked: <reason>" while interlocked.
- aria-pressed - true while the plant reports an on state, such as running or open; false when there is no state or the state is stopped, closed, off, fault, tripped, unknown, false or 0. It follows the feedback tag, not the press.
- aria-disabled="true" - set while interlocked. The button stays in the tab order and stays readable; pressing it raises blocked and announces the reason. This is deliberate: a disabled button tells the operator nothing about what is stopping them.
- aria-hidden="true" - set on the lamp and the hold ring, which are drawn for sighted users and carried in the name for everyone else.
- role="status" - set on the hint under the button, so "Press again to confirm", "Keep holding" and the interlock reason are read as they appear.
- disabled - set on the button when the component is disabled.
Keyboard Interaction
The following keyboard shortcuts are available to interact with the MomentaryButton:
| Key | Action |
|---|---|
| Tab | Moves onto the button, and off it. An interlocked button is still a stop. |
| Space / Enter (down) | Presses the button, as a finger would. A momentary button raises press; a hold button starts its ring; a confirm button waits for the key to come up. Key repeat does not press again. |
| Space / Enter (up) | Releases the button. A momentary button raises release; a hold button raises release with early if the hold was not met; a confirm button arms, or acts if it was armed. |
| Focus leaving | Releases the button, the way a pointer leaving does. A jog held by a key that has lost focus is not still jogging. |
The pointer works the same way: pointerdown presses, pointerup releases, and pointercancel, the pointer leaving the button, or the button losing focus all release too. Such a cancelled press, like a press ended by an interlock, does not arm or confirm a confirm button; only a press let go of on the button does. Every press is paired with a release; an application that starts a motor on press can rely on release arriving.
Localization
All strings the MomentaryButton 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 MomentaryButton uses the following message keys:
- buttonLabel, modeHold, modeConfirm, stateSuffix, interlockSuffix
- armed, holding, blocked
German, French, Spanish and Chinese packs are included in the Smart.Industrial package. The label is a property and is never localized by the button, it is the word on the panel, and the panel is in one language.
Additional information on WAI-ARIA for the SMART Framework can be found here.