Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 66036

Summary: Accessibility failure for MenuItems and TreeItems
Product: [Eclipse Project] Platform Reporter: Brandon Brockway <brockway>
Component: SWTAssignee: Carolyn MacLeod <carolynmacleod4>
Status: RESOLVED WONTFIX QA Contact:
Severity: normal    
Priority: P3 Keywords: accessibility
Version: 3.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Brandon Brockway CLA 2004-06-07 16:12:38 EDT
It is not possible to retieve the name or description for MenuItems or 
TreeItems using any of the accessibility tools on Windows, including 
inspect32, JAWS or Scout (not sure about Linux). Furthermore, there doesn't 
seem to be a way of obtaining an org.eclipse.swt.accessibility.Accessible 
Object for these widgets.
Comment 1 Steve Northover CLA 2004-06-08 14:12:40 EDT
CAR it investigate right away.  Possibly a serious issue for 3.0.
Comment 2 Carolyn MacLeod CLA 2004-06-08 19:16:14 EDT
MenuItems and TreeItems work as expected by default, in the MSAA Inspector, in 
JAWS and in Window-Eyes. I do not have Scout. MenuItems and TreeItems use 
their text as their accessible name, but they do not have a description.

For info on the expected Windows default for Tree View controls, see:
http://msdn.microsoft.com/library/en-us/msaa/msaapndx_3woc.asp

For info on the expected Windows default for Menu Items, see:
http://msdn.microsoft.com/library/en-us/msaa/msaapndx_00q5.asp

In accessibility, "items" are called "children" and they are referenced by 
a "childID", which is typically a 0-based index. The appropriate Accessible 
object to use if you want to override the default behavior is the Accessible 
object of the parent. For example, to override the default accessible name or 
description for a TableItem, simply add an AccessibleListener to the 
Accessible object for the parent Table, eg:

table.getAccessible().addAccessibleListener(new AccessibleAdapter() {
	public void getName(AccessibleEvent e) {
		if (e.childID == ACC.CHILDID_SELF) {
			e.result = "The Table itself";
		} else {
			e.result = "The TableItem with childID=" + e.childID;
		}
	}
});


Note that TreeItems are a little bit different from other items in that the 
childID for a TreeItem is in fact the TreeItem's handle, and not a 0-based 
index (because TreeItems do not have an index). The above code would still 
work fine for a Tree with TreeItem "children", but if you were doing any kind 
of lookup using the childID, you might need to know what the childID 
represented.

As for MenuItem, you are correct that there is currently no SWT API to access 
the IAccessible for a Menu. What do you need it for? The default behavior is 
what one would typically expect. The only use I can think of would be if you 
have a menu that only contains icons - no text. How important is this feature 
to you? We will not be adding anything like this for 3.0.
Comment 3 Carolyn MacLeod CLA 2004-08-23 16:00:47 EDT
Closing this bug as "won't fix". Please open a new bug for the specific case 
of menu items if you have a need to override the default behavior in your 
application, and please explain why you would need this. Thanks.