Bug 275509 - [Viewers] Tree/TableViewer with cell navigation is not accessible
Summary: [Viewers] Tree/TableViewer with cell navigation is not accessible
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.5   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.5 RC1   Edit
Assignee: Thomas Schindl CLA
QA Contact:
URL:
Whiteboard:
Keywords: accessibility
Depends on:
Blocks:
 
Reported: 2009-05-08 15:58 EDT by Carolyn MacLeod CLA
Modified: 2012-09-04 12:53 EDT (History)
4 users (show)

See Also:
bokowski: review+


Attachments
Patch because it was so easy (4.33 KB, patch)
2009-05-08 17:09 EDT, Thomas Schindl CLA
no flags Details | Diff
Without formatting changes (2.18 KB, patch)
2009-05-08 17:43 EDT, Thomas Schindl CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Carolyn MacLeod CLA 2009-05-08 15:58:42 EDT
Run Snippet026TreeViewerTabEditing.
Run the Windows accessibility inspector, inspect32.exe (if you don't have this, you can get it from:
http://www.microsoft.com/downloads/details.aspx?familyid=3755582A-A707-460A-BF21-1373316E13F0&displaylang=en
Click the download button next to inspect32.exe in the table.)

While looking at the Name: field in the inspect32 window, click on a cell in the Snippet's Tree. Using the keyboard and/or the mouse, navigate from cell to cell in the tree. Notice that the Name: field only reflects the cell label in Column 1. The user expects that the accessible Name is the focused cell's label text, not just the cell in Column 1.

I have hacked up some proof-of-concept code to show approximately how accessibility can be added to this Tree. Note that this is awful code, and I don't know where to put it in all of the JFace code, so I threw most of it into the Snippet but I had to temporarily make 2 private JFace methods public to get it to compile, and there's one line needed in SWTFocusCellManager.... but this hack works perfectly. I am assuming that someone with knowledge of the JFace code can use this to help write the correct code.

Here is the hack:
Part 1: Paste the following at the end of the Snippet026TreeViewerTabEditing(final Shell shell) constructor:

v.getTree().getAccessible().addAccessibleListener(new AccessibleAdapter() {
	public void getName(AccessibleEvent event) {
		ViewerCell cell = focusCellManager.getFocusCell();
		if( cell == null ) return;
		ViewerRow row = cell.getViewerRow();
		if( row == null ) return;
		Object element = row.getItem().getData();
		ViewerColumn viewPart = v.getViewerColumn(cell.getColumnIndex());
		if (viewPart == null) return;
		ColumnLabelProvider labelProvider = (ColumnLabelProvider)viewPart.getLabelProvider();
		if (labelProvider == null) return;
		event.result = labelProvider.getText(element);
	}
});

Part 2: Temporarily make ViewerColumn.getLabelProvider() and ColumnViewer.getViewerColumn(final int columnIndex) public, so that this compiles.

Part 3: Paste the following at the end of setFocusCell(ViewerCell focusCell):
	getViewer().getControl().getAccessible().setFocus(ACC.CHILDID_SELF);

Now start up inspect32.exe again and look at the Name: field. Click on any cell and notice that the Name: is now correct. Use the arrow keys to traverse, and notice that the name updates correctly. This will make it possible for screen readers to say the correct thing when the user navigates between cells.

If it is at all possible, could a fix be determined in time for RC1? I have a customer who is hoping that this will be fixed for 3.5. Sorry for the very late notice.
Comment 1 Thomas Schindl CLA 2009-05-08 17:02:40 EDT
Thanks for the code Carolyn. Boris - I'd take a look tomorrow and integrate the code into JFace so that no API change is needed.
Comment 2 Thomas Schindl CLA 2009-05-08 17:09:03 EDT
Created attachment 135027 [details]
Patch because it was so easy

I'd vote with +1 because this a real issue with the current implementation and the feature looks save to me.
Comment 3 Boris Bokowski CLA 2009-05-08 17:18:15 EDT
could you please attach the patch again, without the formatting changes?
Comment 4 Thomas Schindl CLA 2009-05-08 17:43:16 EDT
Created attachment 135033 [details]
Without formatting changes
Comment 5 Carolyn MacLeod CLA 2009-05-08 23:21:08 EDT
Thanks for the very quick response, Tom!
So, all of the code belonged in SWTFocusCellManager - I was so close! <grin>
Comment 6 Boris Bokowski CLA 2009-05-09 09:44:41 EDT
+1 for RC1 from a code point of view. Carolyn, can you verify this for us once it's in a build?
Comment 7 Thomas Schindl CLA 2009-05-10 07:07:58 EDT
released to CVS-HEAD >= 20090510
Comment 8 Thomas Schindl CLA 2009-05-18 11:34:38 EDT
Hm - I forgot to set the target version appropriately :-( but the fix is in the code base. Carolyn could you verify that it works?
Comment 9 Carolyn MacLeod CLA 2009-06-22 15:10:39 EDT
Confirmed. Thanks!
Comment 10 Steve Goldberg CLA 2012-09-04 12:53:42 EDT
This issue was originally reported in version 3.5. Confirmed with Carolyn that the issue is still in version 3.42 (confirmed for accessibility for Optim Designer 9.1).