Custom table cells and NSAccessibilityExceptions
Custom table cells and NSAccessibilityExceptions
- Subject: Custom table cells and NSAccessibilityExceptions
- From: Mickey Roberson <email@hidden>
- Date: Mon, 10 May 2010 17:57:22 -0400
I have implemented custom table cells (subclass of NSTextFieldCell) in my application (a Twitter client). Each cell represents a tweet including things like name, date, tweet text, etc. Within my cell subclass I have the following code:
- (NSArray *)accessibilityAttributeNames { if(validAXAttributes == nil) { validAXAttributes = [[NSArray alloc] initWithObjects:NSAccessibilityRoleAttribute, NSAccessibilityRoleDescriptionAttribute, NSAccessibilityHelpAttribute, NSAccessibilityFocusedAttribute, NSAccessibilityParentAttribute, NSAccessibilityChildrenAttribute, NSAccessibilityWindowAttribute, NSAccessibilityPositionAttribute, NSAccessibilitySizeAttribute, NSAccessibilityEnabledAttribute, NSAccessibilityValueAttribute, nil]; } return validAXAttributes; }
- (id)accessibilityAttributeValue:(NSString *)attribute { if([attribute isEqualToString:NSAccessibilityRoleAttribute]) //AXRole return NSAccessibilityStaticTextRole; if([attribute isEqualToString:NSAccessibilityRoleDescriptionAttribute]) //AXRoleDescription return @"Timeline Tweet"; if([attribute isEqualToString:NSAccessibilityHelpAttribute]) //AXHelp return @"Timeline Tweet"; if([attribute isEqualToString:NSAccessibilityValueAttribute]) { //AXValue SRXTweetObject* tweet = (SRXTweetObject*)[self objectValue]; NSMutableString* readableString = [NSMutableString stringWithFormat:@"%@: %@", [tweet.user displayName], tweet.text]; //Removed for brevity... return readableString; } return [super accessibilityAttributeValue:attribute]; }
For the most part this behaves correctly except that it occasionally reads the Accessibility Content twice. While looking into this in gdb I noticed that multiple NSAccessibilityExceptions are being thrown when I turn VO on with a tweet as main focus.
2010-05-10 17:39:43.954 Syrinx[85907:a0f] NSExceptionHandler has recorded the following exception: NSAccessibilityException -- Attempt to observe "AXTextInputMarkingSessionBegan" on non-observable element: <NSTableViewCellProxy: 0x11d4ebbf0> col:0 row:33 real element:<SRXTableCell: 0x11d51e5a0> Stack trace: 0x7fff81c18a2c 0x7fff827510f3 0x7fff82ed19b9 0x7fff86485c45 0x7fff864839f5 0x7fff8618900b 0x7fff86192f6c 0x7fff8616f541 0x7fff82e16201 0x7fff82e148df 0x7fff85349ada 0x7fff853498df 0x7fff85349798 0x7fff86235a2a 0x7fff86235379 0x7fff861fb05b 0x7fff861f3d7c 0x100001365 0x100001314 0x1 (gdb) continue (gdb) continue 2010-05-10 17:39:44.641 Syrinx[85907:a0f] NSExceptionHandler has recorded the following exception: NSAccessibilityException -- Attempt to observe "AXCreated" on non-observable element: <NSTableViewCellProxy: 0x11e673ac0> col:0 row:33 real element:<SRXTableCell: 0x11d51e5a0> Stack trace: 0x7fff81c18a2c 0x7fff827510f3 0x7fff82ed19b9 0x7fff86485c45 0x7fff864839f5 0x7fff8618900b 0x7fff86192f6c 0x7fff8616f541 0x7fff82e16201 0x7fff82e148df 0x7fff85349ada 0x7fff853498df 0x7fff85349798 0x7fff86235a2a 0x7fff86235379 0x7fff861fb05b 0x7fff861f3d7c 0x100001365 0x100001314 0x1
What am I doing wrong that is causing these exceptions, and how do I fix them? _______________________ Mickey Roberson
MRR Software
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Accessibility-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden