Accessibility and UI Automation
Dock includes a dedicated UI automation layer for docking controls. This improves screen reader discoverability and enables automation clients to query dock state and invoke core actions.
Control coverage
| Control | Peer | Role (AutomationControlType) |
Providers |
|---|---|---|---|
DockControl |
DockControlAutomationPeer |
Pane |
- |
RootDockControl |
RootDockControlAutomationPeer |
Pane |
- |
DockCommandBarHost |
DockCommandBarHostAutomationPeer |
ToolBar |
- |
DockTarget / GlobalDockTarget |
DockTargetAutomationPeer |
Pane |
IInvokeProvider |
DocumentControl |
DocumentControlAutomationPeer |
Pane |
IInvokeProvider |
ToolControl |
ToolControlAutomationPeer |
Pane |
IInvokeProvider |
MdiDocumentControl |
MdiDocumentControlAutomationPeer |
Pane |
IInvokeProvider |
DocumentTabStrip |
DocumentTabStripAutomationPeer |
Tab |
ISelectionProvider, IScrollProvider |
ToolTabStrip |
ToolTabStripAutomationPeer |
Tab |
ISelectionProvider, IScrollProvider |
DocumentTabStripItem |
DocumentTabStripItemAutomationPeer |
TabItem |
IInvokeProvider, selection item support |
ToolTabStripItem |
ToolTabStripItemAutomationPeer |
TabItem |
IInvokeProvider, selection item support |
ToolChromeControl |
ToolChromeControlAutomationPeer |
TitleBar |
IInvokeProvider, IExpandCollapseProvider |
PinnedDockControl |
PinnedDockControlAutomationPeer |
Pane |
IExpandCollapseProvider |
ToolPinnedControl |
ToolPinnedControlAutomationPeer |
Tab |
ISelectionProvider |
ToolPinItemControl |
ToolPinItemControlAutomationPeer |
TabItem |
IInvokeProvider, ISelectionItemProvider |
MdiDocumentWindow |
MdiDocumentWindowAutomationPeer |
Window |
IInvokeProvider |
DockSelectorOverlay |
DockSelectorOverlayAutomationPeer |
List |
IExpandCollapseProvider, ISelectionProvider, IScrollProvider, IValueProvider |
HostWindow |
HostWindowAutomationPeer |
Window |
IInvokeProvider |
HostWindowTitleBar |
HostWindowTitleBarAutomationPeer |
TitleBar |
IInvokeProvider |
PinnedDockWindow |
PinnedDockWindowAutomationPeer |
Window |
IInvokeProvider |
DragPreviewControl |
DragPreviewControlAutomationPeer |
Pane |
IValueProvider |
DragPreviewWindow |
DragPreviewWindowAutomationPeer |
Pane |
Decorative only (non-control/non-content element) |
DockAdornerWindow |
DockAdornerWindowAutomationPeer |
Pane |
Decorative only (non-control/non-content element) |
Provider behavior contract
IInvokeProvideron dock hosts (DocumentControl,ToolControl,MdiDocumentControl), tab items, chrome, and window peers activates/focuses the represented dockable or window.ISelectionItemProvideronDocumentTabStripItemandToolTabStripItemmaps selection actions (Select,AddToSelection) to the same activation path asInvoke.IExpandCollapseProvideronDockSelectorOverlay,ToolChromeControl, andPinnedDockControlcontrols selector visibility, flyout visibility, and pinned dock expansion.IValueProvideronDockSelectorOverlayandDragPreviewControlis read-only and exposes current selected/status text.IScrollProviderandISelectionProvideronDockSelectorOverlaydelegate to the internalPART_ItemsListlist host.
Name and ID resolution
Dock peers resolve automation metadata in this order:
AutomationProperties.Name/AutomationProperties.AutomationId- Dock model fallback (
IDockable.Title,IDockable.Id) - Control fallback (for example,
Document tab,Dock target,Documents selector)
This keeps behavior theme-independent and works even when custom templates are used.
You can override generated metadata directly in XAML:
<DocumentTabStripItem
AutomationProperties.Name="Editor tab"
AutomationProperties.AutomationId="editor-tab-primary" />
State exposure
Peers expose state through HelpText and provider properties. Examples:
- Dock target: horizontal/vertical/global availability flags
- Dock host controls: layout id, docking enabled state, selector visibility, command bar counts
- Document/tool hosts: visible counts, active item, create/layout metadata
- Tab strips: selected index, item count, orientation and create affordances
- Tab items: selected/active and dockable capabilities
- Tool chrome: active/pinned/floating/maximized/menu state
- Pinned hosts: alignment/display mode, expanded state and visible pinned count
- MDI window: active and
MdiState - Selector overlay: open/closed, mode, item count, selected entry
- Drag preview control: preview status and content visibility
- Host/pinned windows: tracked/tool-window/window-state metadata
Automation events
Dock peers raise automation change events for key transitions:
DockSelectorOverlay: expand/collapse (ExpandCollapseStateProperty), selection (SelectionProperty), selected value (ValueProperty), mode/name (NameProperty), and items updates (ChildrenChanged).DocumentTabStripItemandToolTabStripItem: selection state changes (SelectionItemPatternIdentifiers.IsSelectedProperty).DragPreviewControl: status changes (ValuePatternIdentifiers.ValueProperty).
Template requirements
- Keep
PART_ItemsList(ListBox) inDockSelectorOverlaytemplates to preserve fullISelectionProviderandIScrollProviderbehavior for automation readers.
Actions
Primary actions are automation-invokable where applicable:
- Document/tool/MDI host invoke activates the current (or first visible) dockable.
- Tab peers invoke activation and selection of the represented dockable.
- Pinned tab invoke activates the represented pinned tool.
- Tool chrome invoke activates the active tool; expand/collapse opens and closes the tool flyout.
- Pinned dock expand/collapse toggles
IToolDock.IsExpanded. - MDI window invoke activates the represented document window.
- Selector overlay expand/collapse toggles overlay visibility.
- Host and pinned windows invoke to focus/activate their surface.
Keyboard-only selector navigation
Selector overlay keyboard navigation is validated in headless tests:
- Open document selector:
DockSettings.DocumentSelectorKeyGesture(defaultCtrl+Tab) - Open tool selector:
DockSettings.ToolSelectorKeyGesture(defaultCtrl+Alt+Tab) - Navigate:
Tab,Shift+Tab, arrow keys - Commit:
Enteror release selector modifier keys - Cancel:
Esc
See Selector overlay for usage and runtime customization.
Testing automation peers
You can inspect peers programmatically:
Control control = new DocumentTabStripItem { DataContext = document };
AutomationPeer peer = ControlAutomationPeer.CreatePeerForElement(control);
AutomationControlType role = peer.GetAutomationControlType();
string name = peer.GetName();
IInvokeProvider? invoke = peer.GetProvider<IInvokeProvider>();
invoke?.Invoke();
Headless validation in this repository includes:
AutomationPeersTestsfor role/provider/state contracts.AutomationReaderCompatibilityTestsfor peer-tree traversal and automation-reader style pattern usage.DockSelectorKeyboardNavigationTestsfor keyboard-only selector workflows.AutomationPeerLeakTests(Release) to validate event/subscription cleanup and prevent peer-related leaks.
For full control property reference, see Avalonia controls reference.