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

Bug 311809

Summary: [Accessibility] Accessible relations don't show up in accessibility inspector
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+
Target Milestone: 3.6 RC1   
Hardware: Macintosh   
OS: Mac OS X   
Whiteboard:
Attachments:
Description Flags
Fix
none
Fix in progress
none
Final patch none

Description Scott Kovatch CLA 2010-05-05 19:30:34 EDT
I20100504-0800

The two examples for relations aren't working on Cocoa. AccessibleRelationsExample and AccessibleRelationsExample2 demonstrate the addRelation method, and on Cocoa this means that the Accessible in RELATION_LABEL_FOR should show up as an element in the  NSAccessibilityServesAsTitleForUIElementsAttribute list, and the Accessible in the RELATION_LABELLED_BY slot should appear as NSAccessibilityTitleUIElementAttribute.

Neither of these are showing up in Accessibility Inspector.
Comment 1 Scott Kovatch CLA 2010-05-05 20:12:42 EDT
Created attachment 167251 [details]
Fix

The Cocoa attributes weren't being added properly. Also, if the widget is a 'pseudo-label', need to report back ACC_LABEL so we can pick up the label-related properties.
Comment 2 Scott Kovatch CLA 2010-05-06 18:01:20 EDT
Unlike bug 311646, this bug is indeed valid, and fixed with the patch.
Comment 3 Carolyn MacLeod CLA 2010-05-06 18:06:16 EDT
I believe you.  :)
I just ran out of time to look at it today.
Comment 4 Scott Kovatch CLA 2010-05-06 18:14:40 EDT
(In reply to comment #3)
> I believe you.  :)
> I just ran out of time to look at it today.

Oh, I wasn't accusing you of that. Just noting for myself (and you) that this is still fixed.
Comment 5 Carolyn MacLeod CLA 2010-05-12 15:26:23 EDT
Scott, it looks like your new addRelationAttributes is never called?
I ran the 2 relation examples and I don't see any change.

We can't just set the role to LABEL until we know what the "real" role is (i.e. call super).
(It might be a link... or something else).
Comment 6 Scott Kovatch CLA 2010-05-12 16:36:02 EDT
Created attachment 168259 [details]
Fix in progress

Rats.. forgot the changes to Control.java, which call the new addRelationAttributes method. Let me look into the role override. I need to do that when no role is specified for the accessible that is acting as a label, but yes, I probably shouldn't clobber a role that is specified.
Comment 7 Scott Kovatch CLA 2010-05-12 17:17:10 EDT
Created attachment 168271 [details]
Final patch

Much cleaner fix. It's not necessary to override the role at all. VoiceOver will pick up the AXTitle attribute of the element acting as the label.
Comment 8 Carolyn MacLeod CLA 2010-05-12 18:04:22 EDT
addRelationAttributes can't be public, because that makes it API.
If you really want to call it from Control, then you need to put internal_ in front of the method name.
I am ok with the patch as long as you take out the public and call the method
internal_addRelationAttributes
Comment 9 Scott Kovatch CLA 2010-05-12 18:07:50 EDT
Expected for RC1.
Comment 10 Scott Kovatch CLA 2010-05-12 18:14:07 EDT
(In reply to comment #8)
> addRelationAttributes can't be public, because that makes it API.
> If you really want to call it from Control, then you need to put internal_ in
> front of the method name.
> I am ok with the patch as long as you take out the public and call the method
> internal_addRelationAttributes

So noted. I renamed the method and added @noreference around it.
Comment 11 Scott Kovatch CLA 2010-05-12 18:15:21 EDT
Fixed > 20100512.
Comment 12 Carolyn MacLeod CLA 2010-05-13 11:32:19 EDT
Scott, it looks like you may have accidentally committed more than just the patch. There's some extra code in getAttributedStringForRangeParameterizedAttribute in Accessible class (browse changes between revision 1.46 and 1.45), and there's an extra (commented out) method accessibilityIsIgnored in Control class (browse changes between 1.191 and 1.190). You will need to take these extra changes out.

Also, where the javadoc for internal_addRelationAttributes says "This field is <em>not</em> part of the SWT public API.", please change it to "This method...". Thanks!
Comment 13 Carolyn MacLeod CLA 2010-05-13 12:12:02 EDT
SSQ reminded me that you are away for the rest of the week, so we opened bug 312810 to remove the extra code. So you don't need to do anything (except remember not to commit extra code in future <g>).
Comment 14 Scott Kovatch CLA 2010-05-13 21:42:23 EDT
(In reply to comment #13)
> SSQ reminded me that you are away for the rest of the week, so we opened bug
> 312810 to remove the extra code. So you don't need to do anything (except
> remember not to commit extra code in future <g>).

Sorry about that... I had another fix in progress and and forgot about it when I checked in my last fix yesterday. It occurred to me that I had done it about a half hour into my flight. :-\
Comment 15 Carolyn MacLeod CLA 2010-05-13 22:50:52 EDT
No probs. Enjoy the reunion.  :)