Enable Flag
Remember to set -Djavafx.accessible=true when testing.
Currently only Windows 7, 8 and Mac OSX 10.9 are allowed to enable accessibility. Use -Djglass.accessible.force=true to force accessibility on earlier versions of Mac.
Get started documentation:
Mac:
https://developer.apple.com/library/mac/documentation/cocoa/reference/applicationkit/Protocols/NSAccessibility_Protocol/Reference/Reference.html
https://developer.apple.com/library/mac/documentation/UserExperience/Reference/Accessibility_RoleAttribute_Ref/Introduction.html
https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/Accessibility/cocoaAXOverview/cocoaAXOverview.html
Windows:
http://msdn.microsoft.com/en-us/library/windows/desktop/ee684009(v=vs.85).aspx
Under 'UI Automation Fundamentals' some useful links are
UI Automation Control Types Overview - http://msdn.microsoft.com/en-us/library/windows/desktop/ee671197(v=vs.85).aspx
UI Automation Control Patterns Overview - http://msdn.microsoft.com/en-us/library/windows/desktop/ee671194(v=vs.85).aspx
UI Automation -> Reference -> UI Automation Providers
http://msdn.microsoft.com/en-us/library/windows/desktop/ee671217(v=vs.85).aspx
Note, JavaFX is a UI Automation Provider, so that is the part for the doc that we care must.
Narator, JAWS, etc are the UI Automation Clients.
Testing tools:
Mac:
Accessibility Inspector
When running it tracks the mouse, use Cmd + F7 to lock, it stop tracking the mouse and now it allows you to interact in treeview in the tool.
In browse objects, inspect attributes, fire actions, etc.
Voice Over, Cmd+F5 to start, Cmd+F5 to stop.
Windows:
http://msdn.microsoft.com/en-us/library/windows/desktop/dd373661(v=vs.85).aspx
my go to app is the Inspect.exe
Narator, Win+Enter to start, caplock+esc to stop.
How to get start with the code:
Clone the repo to Mac and Windows
run some test cases, test the stuff that is working
slider, all the buttons, tabpane, table, list, imageview,
Get yourself familiar with the testing tool, an inspector-type tool and screenreader on each platform.
Your first control will be Hyperlink.
Here is how to start:
Common code:
Add a new role to javafx.scene.Role, say HYPERLINK
In Hyperlink, override queryAccessibleAttribute to look something like this:
/* Somewhere in the init code */ { setRole(AccessibleRole.HYPERLINK); } @Override protected Object queryAccessibleAttribute(Attribute attribute, Object... parameters) { switch (attribute) { case VISITED: return isVisited(); default: return super.accGetAttribute(attribute, parameters); } }
Notes:
Hyperlink inherits from ButtonBase, so is already know to handle the FIRE action
ButtonBase inherits from Labeled, so it already know to answer for the TITLE attribute.
Basically hyperlink get everything from the hierarchy (see Node#accGetAttribute)
Windows implementation:
Start by visiting http://msdn.microsoft.com/en-us/library/windows/desktop/ee671197(v=vs.85).aspx
follow the link to 'Hyperlink Control Type'
http://msdn.microsoft.com/en-us/library/windows/desktop/ee671631(v=vs.85).aspx
All the Relevant Properties are already done for you, the only one that you need to do something is
UIA_ControlTypePropertyId Hyperlink
Open WinAccessible.java
Add UIA_HyperlinkControlTypeId to it, the value for it is 50005. See
http://msdn.microsoft.com/en-us/library/windows/desktop/ee671198(v=vs.85).aspx
Now go to WinAccessible#getControlType()
add a new case, Role.HYPERLINK->UIA_HyperlinkControlTypeId
Next, Required Control Patterns, I guess the only one we needs is IInvokeProvider.
Since our Hyperlink does not know the target URL we don't need to provide the IValueProvider.
Go to, WinAccessible#GetPatternProvider(), if patternID==IInvokeProvider and role==HYPERLINK then impl=TRUE
Just add 'case HYPERLINK:' over button.
Mac implementation:
Again, start visiting: https://developer.apple.com/library/mac/documentation/UserExperience/Reference/Accessibility_RoleAttribute_Ref/Role.html
See what the 'link' role has to support.
Again, you are getting most the attributes for free.
Go to MacAccessible, find MacRoles, add
NSAccessibilityLinkRole that links to Role.HYPERLINK
The only attribute you need request is NSAccessibilityEnabledAttribute, all the other you get from baseAttributes.
Now, for the NSAccessibilitySelectedAttribute, I'm not sure what it means for a link.
Maybe it maps to 'visited', use the inspector against a native app to find the answer.
For the NSAccessibilityURLAttribute I don't think we can support that as our Hyperlink doesn't have it.
Note also that Link on mac has a subrole, 'Text Link'.
Not sure we need that, need to test what native apps do.
If so then add it to MacAccessbile#MacSubroles.