Bug 21771 - Accessibility for Buttons ignored in JAWS
Summary: Accessibility for Buttons ignored in JAWS
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Carolyn MacLeod CLA
QA Contact:
URL:
Whiteboard:
Keywords: accessibility
: 25740 (view as bug list)
Depends on:
Blocks: 8879 10846 18518 19924
  Show dependency tree
 
Reported: 2002-07-22 13:34 EDT by Tod Creasey CLA
Modified: 2009-03-26 14:57 EDT (History)
9 users (show)

See Also:


Attachments
AccessibleButtonTest, sent to Window-Eyes (1.82 KB, text/plain)
2003-12-08 13:16 EST, Carolyn MacLeod CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tod Creasey CLA 2002-07-22 13:34:16 EDT
Build 20020716

The Accessibility implementation for Buttons is ignored. No matter what I set 
the values to JAWS always reads the value set by setText or nothing if it is 
not sent.

STEPS
1) Open the following example
2) Start JAWS
3) JAWs will only read the group box name and the text value for the button.

import org.eclipse.swt.SWT;
import org.eclipse.swt.accessibility.*;
import org.eclipse.swt.accessibility.AccessibleControlListener;
import org.eclipse.swt.accessibility.AccessibleListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.*;
/*
 * (c) Copyright 2001 MyCorporation.
 * All Rights Reserved.
 */
/**
 * @version 	1.0
 * @author
 */
public class JAWSButtonTest {

	private static AccessibleListener listener = new AccessibleListener() {
		public void getName(AccessibleEvent e) {
			e.result = "Name";
		}

		public void getHelp(AccessibleEvent e) {
			e.result = "Help";
		}

		public void getKeyboardShortcut(AccessibleEvent e) {
			e.result = "Shortcut";
		}

		public void getDescription(AccessibleEvent e) {
			e.result = "Description";
		}
	};

	private static AccessibleControlListener controlListener =
		new AccessibleControlListener() {
		public void getValue(AccessibleControlEvent e) {
			e.result = "Control Value";
		}

		public void getChildAtPoint(AccessibleControlEvent e) {
		}

		public void getLocation(AccessibleControlEvent e) {
		}

		public void getChild(AccessibleControlEvent e) {
		}

		public void getChildCount(AccessibleControlEvent e) {
		}

		public void getDefaultAction(AccessibleControlEvent e) {
		}

		public void getFocus(AccessibleControlEvent e) {
		}

		public void getRole(AccessibleControlEvent e) {
		}

		public void getSelection(AccessibleControlEvent e) {
		}

		public void getState(AccessibleControlEvent e) {
		}

		public void getChildren(AccessibleControlEvent e) {
		}

	};

	public static void main(String[] args) {

		Display display = new Display();
		Shell shell = new Shell(display);
		shell.setText("JAWS test");

		Group group = new Group(shell, SWT.SHADOW_NONE);
		group.setText("Group Title");
		GridLayout layout = new GridLayout();
		layout.numColumns = 2;
		group.setLayout(layout);

		Label label = new Label(group, SWT.NONE);
		label.setText("Label");

		Button button = new Button(group, SWT.PUSH);
		button.getAccessible().addAccessibleControlListener
(controlListener);
		button.getAccessible().addAccessibleListener(listener);
		

		group.setBounds(0, 0, 200, 100);
		shell.setSize(250, 200);
		shell.open();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch())
				display.sleep();
		}
		display.dispose();

	}
}
Comment 1 Veronika Irvine CLA 2002-07-25 10:42:34 EDT
The "Group" parent does not seem to be relevant.  If a button is directly a 
child of a shell and it has an image rather than text, JAWS just says "Button" 
without giving a name etc.

JAWS is calling the following IAccessible methods but is not using the results 
to describe the button:

get_accChild
get_accRole
get_accParent
get_accKeyboardShortcut
get_accState
accLocation
get_accName
get_accHelp
get_accDescription
get_accValue
get_accChild
get_accState

I used the following test:

import org.eclipse.swt.*;
import org.eclipse.swt.accessibility.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;

public class PR21771 {

	private static AccessibleListener listener = new AccessibleListener() {
		public void getName(AccessibleEvent e) {
			e.result = "Name";
		}

		public void getHelp(AccessibleEvent e) {
			e.result = "Help";
		}

		public void getKeyboardShortcut(AccessibleEvent e) {
			e.result = "Shortcut";
		}

		public void getDescription(AccessibleEvent e) {
			e.result = "Description";
		}
	};

	private static AccessibleControlListener controlListener =
		new AccessibleControlListener() {
		public void getValue(AccessibleControlEvent e) {
			e.result = "Control Value";
		}

		public void getChildAtPoint(AccessibleControlEvent e) {
		}

		public void getLocation(AccessibleControlEvent e) {
		}

		public void getChild(AccessibleControlEvent e) {
		}

		public void getChildCount(AccessibleControlEvent e) {
		}

		public void getDefaultAction(AccessibleControlEvent e) {
		}

		public void getFocus(AccessibleControlEvent e) {
		}

		public void getRole(AccessibleControlEvent e) {
		}

		public void getSelection(AccessibleControlEvent e) {
		}

		public void getState(AccessibleControlEvent e) {
		}

		public void getChildren(AccessibleControlEvent e) {
		}

	};

	public static void main(String[] args) {

		Display display = new Display();
		Image image = new Image(display, 
PR21771.class.getResourceAsStream("image.bmp"));
		Shell shell = new Shell(display);
		shell.setText("JAWS test");
		shell.setLayout(new GridLayout(2, false));
		
		Label label1 = new Label(shell, SWT.NONE);
		label1.setText("Label for button 1");
		Button button1 = new Button(shell, SWT.PUSH);
		Accessible accessible1 = button1.getAccessible();
		accessible1.addAccessibleControlListener(controlListener);
		accessible1.addAccessibleListener(listener);
		button1.setText("this is button 1");
		button1.setToolTipText("tooltip for button 1");

		Label label2 = new Label(shell, SWT.NONE);
		label2.setText("Label for button 2");
		Button button2 = new Button(shell, SWT.PUSH);
		Accessible accessible2 = button2.getAccessible();
		accessible2.addAccessibleControlListener(controlListener);
		accessible2.addAccessibleListener(listener);
		button2.setImage(image);
		button2.setToolTipText("tooltip for button 2");
		
		shell.open();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch())
				display.sleep();
		}
		image.dispose();
		display.dispose();

	}
}
Comment 2 Tod Creasey CLA 2002-07-25 11:04:06 EDT
Verified using JAWS and win32 - the name and value are set but are ignored by 
JAWS.
Comment 3 Nick Edgar CLA 2002-07-25 14:17:48 EDT
What does inspect show for this case?
Comment 4 Tod Creasey CLA 2002-07-25 15:24:40 EDT
Here is the trace

How found:	Mouse move (136,82)
	hwnd=0x00110674 32bit class="Button" style=0x54014380 ex=0x0
Info:	IAcc = 0x0014FDAC VarChild:[VT_I4=0x0]
Interfaces:	IEnumVARIANT IOleWindow
Impl:	Remote, need oleacc 4.2.5020.0 or greater
Annotation ID:	[not supported]

Name:	"Name"
Value:	"Control Value"
Role:	push button
State:	focusable
Location:	{l:122, t:75, w:26, h:23}
Description:	"Description"
Kbshortcut:	"Shortcut"
DefAction:	"Press"
Parent:	"Name":window
Help:	"Help"
Help Topic:	none [false]
ChildCount:	0
Window:	0x00110674 class="Button" style=0x54014380 ex=0x0
Children:	Container has no children
Selection:	none [empty]
Ancestors:	"Name" : window : focusable
	"JAWS test" : client : focusable
	"JAWS test" : window : sizeable,moveable,focusable
	"Desktop" : client : normal
	"Desktop" : window : normal
	[ No Parent ]
Comment 5 Nick Edgar CLA 2002-07-31 16:40:57 EDT
Need to verify whether this is an SWT or a JAWS problem.
When SWT is asked for the name and none is set, does it answer the empty string 
or call the default window proc (I'm assuming this will call back through the 
Accessible API)?
Comment 6 Tod Creasey CLA 2002-11-26 15:29:16 EST
I believe this is an SWT problem as JAWS is asking (and getting) the result in 
Veronikas tests. Veronika?
Comment 7 Veronika Irvine CLA 2002-11-27 15:42:30 EST
If the event.result is null or there is no AccessibleListener, then the default 
window result is returned.  Otherwise, the value specified in event.result 
(even if it is an empty sstring) is reported.

I think this is a JAWS problem.
Comment 8 Matthew King CLA 2003-04-24 12:50:13 EDT
If you think this is a JAWS problem, this would be an excellent bug to try 
Window-Eyes on. Window-Eyes has one of the most extensive default 
implementations of MSAA support. In JAWS, use of MSAA is less consistent.
Comment 9 Veronika Irvine CLA 2003-10-16 09:07:56 EDT
Grant, could you try this test on WindowEyes?
Comment 10 Grant Gayed CLA 2003-10-16 10:47:14 EDT
WindowEyes has the same behaviour as described for JAWS.  It always reads the 
Button's text, or none in the case of an image; it does not even ask our 
AccessibleListener or AccessibleControlListener for their answers.
Comment 11 Carolyn MacLeod CLA 2003-12-08 13:16:09 EST
Created attachment 7085 [details]
AccessibleButtonTest, sent to Window-Eyes

I am talking with Mike, a software developer at Window-Eyes. We identified one
area where they have a bug: he says they are supposed to be able to read the
accName for a graphic button with no text (i.e. if GetWindowTextLength is 0,
then they call get_accName, otherwise they just call GetWindowText). I sent him
a little test class (attached) that shows that they don't do this properly, and
he said he was able to replicate the problem with my test case. If he fixes
this, it will mean that Window-Eyes will read graphic buttons.

As for reading the accName for a button that has text, that is a feature
request. I have made the feature request, but he says they have a lot of
higher-priority stuff they are working on, and he says that honestly, it would
be a while before they got to it.

All of the above applies to Labels (Static's) as well.
Comment 12 Carolyn MacLeod CLA 2003-12-08 13:44:28 EST
*** Bug 25740 has been marked as a duplicate of this bug. ***
Comment 13 Carolyn MacLeod CLA 2003-12-08 13:45:27 EST
If anyone has any examples of WHY one would want to override the visible text 
of a text button so that it says something else, please let me know, because 
an example would help me in my discussions with the Window-Eyes people.
Comment 14 Grant Gayed CLA 2003-12-08 14:00:06 EST
How about for a Button with an Image instead of text?
Comment 15 Tod Creasey CLA 2003-12-08 14:11:22 EST
The Color selection button used in Eclipse is our main use case
Comment 16 Carolyn MacLeod CLA 2003-12-08 15:23:40 EST
Excellent! Both of these use cases (button with image and no text, button with 
just a drawn color rectangle and no text) will be fixed if/when Mike fixes the 
bug in Window-Eyes that I pointed out to him. These use cases do not require 
them to implement the feature request of being able to override the visible 
text of a text button. Thanks for the concrete examples.
Comment 17 Carolyn MacLeod CLA 2003-12-18 13:46:01 EST
The bug in Window-Eyes has been fixed. This means that the next version of 
Window-Eyes will correctly read the accName of image buttons and "color" 
buttons - basically, any button without text.

As for overriding the visible text of any non-custom control by providing an 
accName, that remains an outstanding feature request. But as it's not a common 
use case, the feature is not likely to go in any time soon.

Now I just need to keep trying to access a developer at FreedomScientific to 
see if we can get JAWS to read these buttons too, but these people are not as 
responsive as the Window-Eyes people are.
Comment 18 Carolyn MacLeod CLA 2003-12-18 16:07:38 EST
Further info from the Window-Eyes developer about the likelihood of having the 
feature request implemented:

"We have noted the feature suggestion and might implement it in the future 
(especially for ownerdrawn controls) if we see real examples of a need for the 
feature.  Note that we have seen controls (even standard ones) blow up when we 
make MSAA queries with both the inspect and accevent methods so this feature 
would definately have to be optional."
Comment 19 Carolyn MacLeod CLA 2004-02-11 17:12:44 EST
This is fixed for buttons in the JAWS 5.0 upgrade (5.00.809).
JAWS now reads the MSAA name of both graphic buttons and text buttons.
You can go ahead and give all of your graphic buttons and color buttons nice 
names now!  :)

Unfortunately, JAWS does not read the MSAA name of Labels (graphic or text).

Leaving this bug report open until JAWS reads the MSAA name for Labels, and 
Window-Eyes reads the MSAA name for text Buttons and graphic/text Labels. 
Might be a while. But note that the current behavior of both applications is a 
significant improvement, that works for the most common use case: graphic 
buttons.
Comment 20 Carolyn MacLeod CLA 2004-04-29 16:25:38 EDT
Closing this bug because the important stuff is fixed and there's nothing more 
we can do - the rest is in the hands of the screen readers now.
Comment 21 Grant Gayed CLA 2004-05-04 10:16:49 EDT
*** Bug 60884 has been marked as a duplicate of this bug. ***
Comment 22 Carolyn MacLeod CLA 2009-03-26 14:57:37 EDT
*** Bug 270039 has been marked as a duplicate of this bug. ***