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

Bug 313453

Summary: [Accessibility] AccessibleShapesExample doesn't show image properties
Product: [Eclipse Project] Platform Reporter: Scott Kovatch <skovatch>
Component: SWTAssignee: Scott Kovatch <skovatch>
Status: RESOLVED FIXED QA Contact: Carolyn MacLeod <carolynmacleod4>
Severity: normal    
Priority: P3 CC: Silenio_Quarti
Version: 3.6Flags: carolynmacleod4: review+
Silenio_Quarti: review+
Target Milestone: 3.5 RC2   
Hardware: Macintosh   
OS: Mac OS X   
Whiteboard:
Attachments:
Description Flags
Fix
none
New fix
none
other patch none

Description Scott Kovatch CLA 2010-05-18 20:18:11 EDT
I20100516-0800

The AccessibleShapesExample doesn't pick up the accessibility titles of the shapes. They also report a children attribute, which isn't right.

Run the AccessibleShapesExample and then turn on Accessibility Inspector to see the problems.
Comment 1 Scott Kovatch CLA 2010-05-18 20:19:52 EDT
Created attachment 169034 [details]
Fix
Comment 2 Scott Kovatch CLA 2010-05-18 20:20:21 EDT
Comment on attachment 169034 [details]
Fix

Nice and simple. Just add the missing attributes and remove the incorrect ones.
Comment 3 Silenio Quarti CLA 2010-05-19 12:14:02 EDT
I do not think you can remove the children attribute all the time. The canvas could have a real child ( a label or something). I see the Accessibility Verifier gives a warning. Is that the only problem?

public static void main(String[] args) {
		display = new Display();
		shell = new Shell(display);
		shell.setLayout(new FillLayout());
		
		Shape redSquare = new Shape(shell, SWT.NONE);
		redSquare.setColor(SWT.COLOR_RED);
		redSquare.setShape(Shape.SQUARE);
		
		Label label = new Label(redSquare, SWT.NONE);
		label.setText("Label");
		label.setBounds(10, 10, 30, 30);
		
		Shape blueCircle = new Shape(shell, SWT.NONE);
		blueCircle.setColor(SWT.COLOR_BLUE);
		blueCircle.setShape(Shape.CIRCLE);

		Shape greenSquare = new Shape(shell, SWT.NONE);
		greenSquare.setColor(SWT.COLOR_GREEN);
		greenSquare.setShape(Shape.SQUARE);

		shell.pack();
		shell.open();
		redSquare.setFocus();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch()) display.sleep();
		}
	}
Comment 4 Scott Kovatch CLA 2010-05-19 12:28:30 EDT
(In reply to comment #3)
> I do not think you can remove the children attribute all the time. The canvas
> could have a real child ( a label or something). I see the Accessibility
> Verifier gives a warning. Is that the only problem?

Accessibility Inspector was complaining, yes. That's why I noticed it. 

The notion of an image having a child is somewhat mindblowing, but I see your point.

I need to rethink this a bit. The real problem is that the AXTitle needs to be added to the set because the AccessibleListener implemented getName() and not just because ROLE_GRAPHIC is being used.
Comment 5 Scott Kovatch CLA 2010-05-19 12:59:56 EDT
Created attachment 169151 [details]
New fix

See if a description or title is being provided by any of the listeners, and if so add the Cocoa attribute to the list. We really should do this for all of the things that accessible listeners can provide, but at this point in the release cycle this is the bare minimum I think we need to do.
Comment 6 Silenio Quarti CLA 2010-05-19 14:44:21 EDT
Created attachment 169183 [details]
other patch

Car and I think it is better keep the fix simple for now. Just add the attributes needed for GRAPHIC. We can rethink this in 3.7. Is that ok?
Comment 7 Scott Kovatch CLA 2010-05-19 15:13:09 EDT
(In reply to comment #6)
> Car and I think it is better keep the fix simple for now. Just add the
> attributes needed for GRAPHIC. We can rethink this in 3.7. Is that ok?

You end up with AXDescription showing up as an empty string in Accessibility Inspector because nothing implements the description property. It's not correct, but also not critical -- VoiceOver still works as expected.

I do think we need to make the general fix, but this is better than nothing given where we are in 3.6.
Comment 8 Carolyn MacLeod CLA 2010-05-19 15:33:25 EDT
Good to go. I think a graphic is more likely to have a description than many other roles, particularly if it is a complicated image.
Comment 9 Scott Kovatch CLA 2010-05-19 17:54:52 EDT
Only the second patch here was committed. I'm leaving the first visible so we can go back to it for the general fix. 

Fixed > 20100519.