Instrument readouts and controls
Bit Field <smart-bit-field>
BitField displays a fixed-width register as individual bits with names, keeping the word value and the bits in sync.
Accessibility Attributes
The BitField shows a hardware register as its individual bits. It is a composite widget: a 16-bit or 64-bit register is one tab stop with arrow key navigation between the bits, not one tab stop per bit. Every bit announces its number, its name where the register map provides one, and its state, because a lit or unlit block conveys nothing to a screen reader.
The following ARIA attributes are used inside the BitField:
- role="group" - set on the register, with an aria-label naming the word length, so the bits are announced as one named group rather than a run of loose buttons.
- aria-label (on each bit) - carries the bit's number and state, and its name when the register map gives one - "READY, bit 0, set". A bare "1" or "0" is meaningless without knowing which bit it belongs to.
- aria-label (read-only bits) - appends "read only", so a reserved bit is identifiable before an operator tries to change it rather than after.
- aria-pressed - indicates whether each bit is set.
- aria-hidden="true" - set on the visible digit, index and name, all of which the bit's own aria-label already contains. Without it a reader announces the same bit twice.
- tabindex - managed as a roving tab stop: the active bit is 0, every other bit is -1.
Keyboard Interaction
The following keyboard shortcuts are available to interact with the BitField:
| Key | Action |
|---|---|
| Tab | Moves into the register, landing on the bit that holds the tab stop, and out again. One stop for the whole word. |
| Arrow Left/Right | Moves between bits, in display order. Reversed when rightToLeft is set. |
| Home / End | Moves to the first / last bit as displayed. |
| Enter or Space | Toggles the focused bit, when interactive is set. A bit marked readOnly in the register map does not change. |
The word readout beneath the bits is text and updates with them, so a reader can be pointed at the whole register value rather than reading sixty-four bits one at a time.
Localization
All strings the BitField 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 BitField uses the following message keys:
- fieldLabel
- bitLabel
- namedBitLabel
- set
- clear
- reserved
- readOnly
Additional information on WAI-ARIA for the SMART Framework can be found here.