Accessibility Architecture
The design is based on Microsoft UI Automation which helps provide us a low overhead path to implementation on Windows. This design scales well to NSAccessibility protocol on Mac platform too.
<Insert image FXDesign.png>
Overview
AccessibleStage initializes and maintains a graph of all accessible implementation of UI controls. Every node in the scene graph can support accessibility by returning a corresponding object that implements accessibility, using the method getAccessible().
The super class of all components supporting accessibility is AccessibleNode. AccessibleNode implements AccessibleProvider. AccessibleNode maintains a reference to the Glass accessible object which in turn creates/maintains a reference to the native accessible object..
AccessibleStage is responsible for creating the native object and associating it with the AccessibleNode.
Each control defines its accessible providers by super class AccessibleNode or subclassed implementation for control specific providers.
Example AccessibleButton, AccessibleList, and AccessibleMenu.
Accessible providers
Accessible providers are a package of interfaces which define the accessible behavior of controls. A control may have one or more providers it may implement. AccessibleProvider is the base provider for any control to support accessibility. Multiple providers implemented by controls define its accessible behavior.
See package com.sun.javafx.accessible.providers for a list of providers.
AccessibleProvider
AccessibleStageProvider
ExpandCollapseProvider
GridItemProvider
GridProvider
InvokeProvider
RangeValueProvider
SelectionItemProvider
SelectionProvider
ToggleProvider
ValueProvider
<TODO:> Add short description of the features of the various providers.
Accessible utils
Accessible utils define static identifierts used by accessible providers applicable to various controls.
See package com.sun.javafx.accessible.utils for list of values.
ControlTypeIds
EventIds
ExpandCollapseState
NavigateDirection
OrientationType
PatternIds
PropertyIds
ProviderOptions
Rect
ToggleState
Accessibility Initialization
Accessibility is initialized, using the following flow of events:
On Windows / Mac:
(WM_GETOBJECT / accessibilityAttributeNames) → Bridge calls up into glass to Window → notifyInitAccessibility()
This call passes through quantum → StagePeerListener → which instantiates AccessibleStage.
AccessibleStage
AccessibleStage : initAccessibleHierarchy ()
-
On instantiation it initializes the corresponding accessible hierarchy for FX scene graph
-
For native object handle it makes a down call to bridge to create its associated native accessible component and saves its value in the AccessibleNode.
-
Attaches a listener for any new nodes being added to the scene graph.
-
Attaches a listener for any new Stage, Scene added to the window, which in return will add a listener to Scene for new node additions.
-
Attaches a Focus listener for tracking change of Focus.
AccessibleStage : updateAccessibleHierarchy ()
-
When a node is added or removed, make a down call to notify native bridge to add or remove the native accessible component.
-
Update AccessibleHierarchy
AccessibleStage : FocusChangeListener ()
-
Down call to Bridge to notify focus change
AccessibleNode
-
AccessibleNode is the super class implementation of the accessible behavior for all node
-
Implements common accessibility behavior for a node
-
Implements AccessibleProvider
-
Common accessible behavior that apply to nodes are:
-
Name, Description, State, Selection, Parent, Child, ScreenLocation, Height, Width, HitTest, Focus, Help, Keyboard Shortcut
-
AccessibleText
-
extends AccessibleNode
AccessibleControl
-
AccessibleControl is the super class implementation of the accessible behavior for all controls
-
Implements common accessibility behavior for any control in JavaFX.
-
extends AccessibleNode
-
Common accessible behavior that apply to controls are:
-
Name, Description, State, Selection, Parent, Child, ScreenLocation, Height, Width, HitTest, Focus, Help, Keyboard Shortcut
-
All controls extends from AccessibleControl
AccessibleButton
-
Extends AccessibleControl
-
Listener for change of properties that are not focus driven
-
Button specific Accessible behavior such as:
-
Name, Role, Value, DefaultAction, DoDefaultAction
-
AccessibleRadioButton
-
extends AccessibleControl
-
implements provider SelectionItemProvider
-
Listener for control specific property changes
AccessibleList
-
extends AccessibleControl
-
implements provider SelectionProvider and GridProvider
AccessibleListItem
-
extends AccessibleControl
-
implements provider SelectionItemProvider and GridItemProvider
AccessibleCheckBox
-
extends AccessibleControl
-
implements provider ToggleProvider
AccessibleSlider
-
extends AccessibleControl
-
implements RangeValueProvider
<TODO:Add other Controls>