| Summary: | [Workbench] Tool bar buttons require mouse focus to get read using MSAA | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Tod Creasey <Tod_Creasey> | ||||
| Component: | UI | Assignee: | Tod Creasey <Tod_Creasey> | ||||
| Status: | CLOSED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P2 | CC: | dipalerm, Kevin_Haaland, matt, Tod_Creasey, twolff | ||||
| Version: | 3.0 | Keywords: | accessibility | ||||
| Target Milestone: | --- | ||||||
| Hardware: | PC | ||||||
| OS: | Windows XP | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
|
Description
Tod Creasey
UI needs to add a name to each of the toolbar buttons so that JAWS knows what
name to read. Even if all you do is answer the tooltip as the MSAA name, that
will work. Here is an SWT snippet that lets me tab through the buttons, and
JAWS reads all of the names. Moving this bug back to UI.
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.accessibility.*;
public class AccessibleToolBarTest {
static Display display;
static Shell shell;
static String[][] toolImageFileNames = {
{"search"},
{"script_wiz"},
{"new_wiz>", null, "save", "saveas", "printer"},
{"debug", "run"},
{"opentype"},
{"newjprj_wiz", "newpack_wiz", "newclass_wiz>", "newint_wiz", "newsbook
_wiz"},
};
static String[][] toolTips = {
{"Search"},
{"Script"},
{"New", null, "Save", "Save As", "Print"},
{"Debug", "Run"},
{"Open Type"},
{"New Java Project", "New Package", "New Class", "New
Interface", "New Java Script"},
};
public static void main(String[] args) {
display = new Display();
shell = new Shell(display);
shell.setLayout(new GridLayout());
shell.setText("ToolBar Button Names");
for (int tb = 0; tb < toolImageFileNames.length; tb++) {
ToolBar toolBar = new ToolBar(shell, SWT.FLAT);
String[] toolBarFileNames = toolImageFileNames[tb];
for (int tool = 0; tool < toolBarFileNames.length;
tool++) {
String fileName = toolBarFileNames[tool];
if (fileName == null) {
new ToolItem(toolBar, SWT.SEPARATOR);
} else if (fileName.endsWith(">")) {
ToolItem item = new ToolItem(toolBar,
SWT.DROP_DOWN);
item.setImage(createToolBarIcon(display,
fileName.substring(0, fileName.length() - 1)));
item.setToolTipText(toolTips[tb]
[tool]);
} else {
ToolItem item = new ToolItem(toolBar,
SWT.PUSH);
item.setImage(createToolBarIcon(display, fileName));
item.setToolTipText(toolTips[tb]
[tool]);
}
}
toolBar.getAccessible().addAccessibleListener(new
AccessibleAdapter() {
public void getName(AccessibleEvent e) {
if (e.childID != ACC.CHILDID_SELF) {
Accessible accessible =
(Accessible) e.getSource();
ToolBar toolBar = (ToolBar)
accessible.getControl();
ToolItem item = toolBar.getItem
(e.childID);
if (item != null) {
e.result =
item.getToolTipText();
}
}
}
});
}
shell.pack();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) display.sleep();
}
display.dispose();
}
static Image createToolBarIcon(Display display, String fileName) {
try {
ImageData source = new ImageData
(AccessibleToolBarTest.class.getResourceAsStream(fileName + ".gif"));
ImageData mask = source.getTransparencyMask();
return new Image(display, source, mask);
} catch (Exception e) {
}
return null;
}
}
Created attachment 9261 [details]
gifs for toolbar snippet
Sorry - you will need to have some gifs to try out the SWT snippet. I am
zipping them and attaching them here.
We should also check against 2.1.3 to be sure that this was the case then too. This one is currently in the public accessibility list. I wrote the code for you - here it is. It is an easy fix, and anyone who adds
a tooltip to their toolbar button will be accessible for free. Please add it
for 3.0. Thanks! (oh, this just fixes the main toolbar and the perspective
switching toolbar. I leave it up to you to add this same fix to the view
toolbars - I don't know the framework well enough).
In org.eclipse.jface.action.ToolBarManager class, method createControl:
public ToolBar createControl(Composite parent) {
if (!toolBarExist() && parent != null) {
toolBar = new ToolBar(parent, itemStyle);
toolBar.setMenu(getContextMenuControl());
update(false);
toolBar.getAccessible().addAccessibleListener(new
AccessibleAdapter() {
public void getName(AccessibleEvent e) {
if (e.childID != ACC.CHILDID_SELF) {
try {
ToolBar bar = (ToolBar)
((Accessible)e.getSource()).getControl();
ToolItem item = bar.getItem
(e.childID);
if (item != null) {
String toolTip =
item.getToolTipText();
if (toolTip != null) {
e.result =
toolTip;
}
}
} catch (ClassCastException ex) {
} catch (IllegalArgumentException ex) {
}
}
}
});
}
return toolBar;
}
*** Bug 58908 has been marked as a duplicate of this bug. *** Is this going into 3.0? no plans to put this in for 3.0 if it is not already in. Michael are we going to do this for 3.1? If not then we should mark this WONTFIX Patch released (with some refactoring) to builds > 20040713 Marking closed |