Keyboard Accessibility
Nodes and edges are in the tab order, a focused node that is out of view is panned into it, and every change is announced through a live region. The toolbar switches each part of that - which elements Tab reaches, keyboard support as a whole, the pan and its speed - and makes an announcement of the page's own.
Selection nothing selected
Announced by the page -
Press Tab to move between the nodes and edges of the diagram.
Press Enter or Space to select it, Shift with Enter to add it to the selection, the arrow keys to move the selected nodes, Delete to remove them and Escape to clear the selection. Press C to start a connection from it.
Press Enter or Space to select it, Delete to remove it and Escape to clear the selection. Press C to move its end to another node.
bit BlowTry it
- Click the background to give the canvas focus, then press Tab again and again: focus moves through the edges, then the nodes. The workflow is wider than the view, and when focus reaches a node outside it the view slides along to show it.
- Press Enter or Space to select the focused node or edge (Shift+Enter adds it to the selection) - the panel names what is selected. Move a selection with the arrow keys, clear it with Escape and remove it with Delete.
- Untick Edges focusable or Nodes focusable, then Tab again: that kind is skipped.
- Tick Disable keyboard support: Tab skips every node and edge, and the arrow keys no longer move a selection made with the mouse.
- Untick Pan to the focused node and Tab out of view: focus moves on, but the view stays put. Set over to 0 ms to jump instead of sliding, or 800 ms to watch the slide.
- Select something and press Announce selection: the page puts a sentence of its own in the canvas's live region, and a screen reader reads it out.
- Reset puts the workflow, the view and the panel back as they started.
- With a screen reader on - Narrator, VoiceOver, NVDA - you hear each element's name and keys as focus arrives, and every selection, move and deletion as it happens. The Localization example shows those announcements on screen.
How it works
NodesFocusableandEdgesFocusable(both true) put each kind in the tab order; focus follows the order they are drawn in, edges beneath nodes. A node or an edge's ownFocusabletakes out just that one.DisableKeyboardA11y(false) takes every node and edge out of the tab order and turns the arrow keys and connecting from the keyboard off; Delete and Escape still act on a selection.AutoPanOnNodeFocus(true) pans a node that takes keyboard focus into view - only as far as needed, so the reader keeps their place - overAutoPanOnNodeFocusDurationmilliseconds (200; 0 jumps).Announce(message)puts a message of the app's own in the polite live region the canvas announces its changes in; saying the same thing twice is still read the second time.AriaLabelnames the canvas itself ("Approval workflow" rather than the default "Flow diagram"), and a node'sAriaLabel- on In review here - replaces itsLabelas its spoken name.OnSelectionChangefills the panel, which is aBlowPanelinside the canvas.DefaultViewportsets where the view opens; Reset returns there withSetViewport.