SHOULD FIX before final code merge
- NO - View.getAccessible() should follow the notify*() pattern to reflect that it's a native callback. Anthony Petrov
- YES - Classes in win/, mac/, etc. should start with a Win*, Mac*, etc. prefixes (as much as I don't like the naming scheme, we should stick to the pattern to avoid confusion).
- NO - Use javaIDs instead of statics for MIDs in GlassAccessible.cpp
- YES - Perhaps instead of using the PlatformFactory, we should add a new factory method to the Application class in Glass.
- Support Windows 7. Currently GlassAccessibility extends ISelectionItemProvider, which is only supported since Windows 8. We may want to eliminate the direct code dependency on Win8 interfaces and use some dynamic techniques to support both Win8 & Win7. Anthony Petrov
The problem is that after trying to expand the FX window in the UISpy tree, the get_HostRawElementProvider() in GlassAccessible gets a NULL hwnd from Java code, then it passes it to UiaHostProviderFromHwnd(). The latter function reports an error E_INVALIDARG. Windows 8 just eats it and proceeds, but Windows 7 can't do so for some reason. I suppose we should make sure the HWND is never NULL (it shouldn't be, really). Investigating further...
Fixed by returning S_OK from get_HostRawElementProvider(). - MAYBE - A11y support enums and classes should probably be moved to javafx.scene.accessibility package rather than be in the scene package itself.
- YES - Fix lines indentations
- RadioGroup. AccessibleProvider.
- (Factory, Variant prefix, IAccessibleProvider - DONE), Combo, Popup, Menu - Anthony
To ensure we're compatible with Win7, we should use the Windows Desktop documentation in MSDN and check if interfaces that we use are supported on Win7.
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.
Window:
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 sandbox 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 accGetAttribute to look something like this:
@Override protected Object accGetAttribute(Attribute attribute, Object... parameters) { switch (attribute) { case ROLE: return Role.HYPERLINK; 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.