Bug 385552 - JAWS can not read out ToolItem's tooltip when toolitem is selected via tab key
Summary: JAWS can not read out ToolItem's tooltip when toolitem is selected via tab key
Status: RESOLVED WORKSFORME
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.2   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Carolyn MacLeod CLA
QA Contact:
URL:
Whiteboard:
Keywords: accessibility
Depends on:
Blocks:
 
Reported: 2012-07-19 16:53 EDT by Chunqiu Ji CLA
Modified: 2012-07-23 10:37 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chunqiu Ji CLA 2012-07-19 16:53:53 EDT
Build Identifier: 

My Eclipse application uses below codes to create the toolitem:

ToolItem newButton = new ToolItem(toolBar, SWT.NONE);  	 newButton.setImage(icon);
newButton.setToolTipText(tooltip);

When application is launched, the toolitem's tooltip cannot be readout
by JAWS reader when the toolitem gets the focus via tab key.

Reproducible: Always
Comment 1 Carolyn MacLeod CLA 2012-07-23 10:37:39 EDT
In order to get tool items to be accessible, you need to add an accessible listener to the ToolBar that you created, as follows:

toolBar.getAccessible().addAccessibleListener(new AccessibleAdapter() {
	public void getName(AccessibleEvent e) {
		if (e.childID != ACC.CHILDID_SELF) {
			ToolItem item = toolBar.getItem(e.childID);
			if (item != null) {
				String toolTip = item.getToolTipText();
				if (toolTip != null) {
					e.result = toolTip;
				}
			}
		}
	}
});

You can see an example of where this is done in org.eclipse.jface.action.ToolBarManager.createControl(Composite).

If you use the org.eclipse.jface.action.ToolBarManager's ToolBarManager() or ToolBarManager(int) constructors to create your toolbars, then your tool items will have accessibility for free, and JAWS will read the tool item tooltips.
The Eclipse SDK uses this method to create all of its toolbars.

Note that if you use the ToolBarManager(ToolBar) constructor, the javadoc says:
 * <strong>NOTE</strong> When creating a ToolBarManager from an existing
 * {@link ToolBar} you will not get the accessible listener provided by JFace.
so if you choose to use that constructor, you would have to add the accessible listener to your toolbar yourself.