Keyboard and accessibility
Shortcuts, pointer tips and what screen readers get from each control.
Every control can be used without a pointer, and the same shortcuts work in every runtime. They also apply to a custom control built on a headless hook.
Moving between controls
Tab and Shift+Tab move focus through the controls in the order they are drawn. A focus ring shows around the focused control, only for keyboard focus: a click or a double-click never draws it. Disabled controls are skipped.
Inside a SegmentedControl the group is a single stop, and the arrow keys move within it.
Shortcuts
For a binding you implement with Soundor keyboard events, formatShortcut('Mod+Shift+Z') from @soundor/components formats its label as ⇧⌘Z on macOS and Ctrl+Shift+Z on Windows and Linux. Use { spoken: true } for words instead of symbols. Check for conflicts with DAW shortcuts before choosing a binding.
Knob, Slider, Fader and ValueField
| Input | Does |
|---|---|
← ↓ / → ↑ | Decrease / increase by 1% of the range |
Page Down / Page Up | Decrease / increase by 10% of the range |
Home / End | Go to the minimum / maximum |
Delete or Backspace | Reset to the default |
Shift with any key above | Ten times finer |
| Mouse wheel | Change by 1% per notch, Shift for finer |
| Drag | Change; Shift while dragging for fine control |
| Double-click | Reset to the default; type a value on a ValueField |
Alt-click (Option-click) | Reset to the default, ValueField included |
Esc while dragging | Cancel the drag and restore the value |
Steps follow the control's mapping, so on a log-scaled frequency control 1% is a step along the curve, not a fixed number of hertz. A Slider pressed on its thumb grabs it where it is; pressed elsewhere, it jumps there and then follows the pointer (hold Shift to grab the thumb where it is from anywhere). A double-click resets it only on the thumb: one elsewhere jumps, and resets nothing.
ValueField takes a double-click or Enter to type a value, and Enter again to apply it or Esc to leave it unchanged. See Typing a value for what it accepts.
Buttons
| Input | Does |
|---|---|
Enter or Space | Press a Button, switch a Toggle |
← ↑ / → ↓ | Select the previous / next option |
Home / End | Select the first / last option |
In a SegmentedControl the selection follows focus and wraps around at the ends.
XYPad and draggable Plot markers
| Input | Does |
|---|---|
← / → | Decrease / increase X |
↓ / ↑ | Decrease / increase Y |
Shift with an arrow | Ten times finer |
Delete or Backspace | Reset both axes to their defaults |
| Drag | Move both values; Shift for fine control |
| Double-click on the handle | Reset both axes to their defaults |
Alt-click (Option-click) | Reset, as a double-click does |
Esc while dragging | Cancel the drag |
An XYPad pressed on its handle grabs it where it is; pressed elsewhere, the handle jumps to the pointer, and a double-click there jumps without resetting. Every marker with onMove on a Plot is its own tab stop and behaves like an XYPad, except that a marker never jumps: it is grabbed where it is.
Select, DropdownMenu and ContextMenu
| Input | Does |
|---|---|
Enter, Space (and ↓ ↑ on a Select) | Open; focus goes into the list or menu |
Shift+F10 or the context menu key | Open a ContextMenu beside the focused control |
↑ / ↓, Home / End, Page Up / Page Down | Move, skipping disabled items and dividers |
| A letter | The next item whose label starts with it |
Enter or Space | Choose |
Esc, Tab or a click outside | Close, and give focus back to where it was |
A list or menu keeps focus while it is open, and holds it inside the editor. Esc closes the topmost one only: a menu opened from a Modal closes and leaves the modal open.
EnvelopeEditor
Each handle is a tab stop. On the attack, sustain and release handles the arrow keys, Page Up, Page Down, Home, End and the wheel work as on a Knob; on the decay handle, ← → move the decay and ↓ ↑ the sustain. Double-click, Alt-click, Delete or Backspace resets a handle's stage (on the decay handle, the decay only: the sustain has its own), and Esc cancels a drag. See EnvelopeEditor.
ResizeGrip
← → ↑ ↓ resize the editor by a few pixels; Shift makes the step five times larger.
Tips
- Fine adjustment is
Shift. It works on keys, wheel and drag alike, so it is the one habit worth teaching. - Double-click is the reset, and so are
Alt-click andDelete.Alt-click (Option-click on a Mac) is the reset in Pro Tools and Logic, and the one that works on a ValueField too, where a double-click types a value. Set the parameter's default and users always have a way back. Bound controls take it from the parameter; others takedefaultValue. - Typing beats dragging for exact values. A ValueField beside a Knob or a Fader gives both.
- Cancel with
Esc. A drag is one gesture for the host, andEsccancels it and restores the value from before.
What assistive technology gets
| Control | Role | What it reports |
|---|---|---|
| Knob, Slider, Fader, ValueField | adjustable | Label, formatted value, minimum, maximum |
| XYPad, Plot marker | adjustable | Both values in one phrase, such as "Cutoff 1.20 kHz, Resonance 35%" |
| Button | button | Label, disabled |
| Toggle | switch or togglebutton | Label, on or off |
| SegmentedControl | radiogroup of radio | Group label, each option, which one is selected |
| LevelMeter | progressbar | Label and level; the clip indicator is a button that clears it |
| Plot | image | Its accessibilityLabel, or its title |
| Select | combobox, then a menu | Label, chosen option, whether it is open; each option, the chosen one checked |
| DropdownMenu, ContextMenu | menu of menuitem | The menu's label, item labels and hints, disabled and checked items |
| EnvelopeEditor handle | adjustable | The stage's name and value, such as "Decay 300 ms, Sustain 65%" |
| Panel, ControlGroup | header | The title |
Adjustable controls also offer the actions a screen reader lists: increment, decrement, set value and reset to default. An XYPad adds Increase and Decrease for its Y axis.
Actions of your own
Every control takes accessibilityActions and onAccessibilityAction. Your actions are offered after the control's own, which stay first and stay the control's: an action named like one of its own is left out, and asking for one of its own never reaches your handler. A ContextMenu uses this to offer the platform's "show menu" action (showContextMenu), after the control's own: its trigger keeps the control's role, name and value.
<Knob
parameter={parameters.cutoff}
accessibilityActions={[{ name: 'learn', label: 'MIDI learn' }]}
onAccessibilityAction={(event) => {
if (event.actionName === 'learn') startLearn('cutoff');
}}
/>Every control also takes a ref to the node assistive technology is on (a SegmentedControl's is its group, and its options each offer your actions). A DropdownMenu places its menu beside its trigger by that ref.
Making your plug-in accessible
- Give every control a name. A bound control takes its label from the parameter. Without one, pass
labeloraccessibilityLabel: a nameless knob is announced as a number alone. - Describe what is not obvious.
accessibilityHintis read after the name: "Drag, or use the arrow keys" is built in for the resize grip, and your own hints belong on anything unusual. - Label plots, and say what they show. A Plot is announced as an image, so
accessibilityLabel="Compressor transfer curve"is what a screen reader user gets. Put the numbers that matter in a control beside it: a Plot's draggable markers are reachable, but the curve itself is not described. - Do not rely on colour. The clip and warning colours of a LevelMeter are also in its reported level, and the accent variants of a Button always have text. Keep that when you theme.
- Keep focus visible. If you restyle a component with
StyleProps, keep its focus ring, or draw your own fromfocusVisiblein a headless hook.