Present the document view as a group to VoiceOver/accessibility

This enables VoiceOver user to see the document view as a single
element and interact with it (i.e. inspect its subelements) only when
needed by using the VO-Shift-down shortcut (and stop interacting with
it using VO-Shift-up shortcut). This makes the element structure more
hierarchical where at the top level are only major user interface
components, so that it's easier for orientation. It also prevents
unrelated UI elements to be sequential as VoiceOver by default orders
elements by the visual order (top-down, left-right) rather then
the order in the AXChildren array. For example in this case,
the bottom status bar of the document window gets separated from
the bottom toolbar of the file browser, unlike the situation before
grouping when both bars were adjacent to the VoiceOver user.
This commit is contained in:
Boris Dušek
2013-03-02 16:27:10 +01:00
committed by Allan Odgaard
parent 944e1e32fa
commit f4e2de14f2

View File

@@ -814,4 +814,38 @@ static std::string const kBookmarkType = "bookmark";
document->buffer().remove_all_marks(kBookmarkType);
[[NSNotificationCenter defaultCenter] postNotificationName:GVColumnDataSourceDidChange object:self];
}
// =================
// = Accessibility =
// =================
- (BOOL)accessibilityIsIgnored
{
return NO;
}
- (NSArray*)accessibilityAttributeNames
{
static NSArray* attributes = nil;
if(!attributes)
{
NSSet* set = [NSSet setWithArray:[super accessibilityAttributeNames]];
set = [set setByAddingObjectsFromArray:@[
NSAccessibilityRoleAttribute,
NSAccessibilityDescriptionAttribute,
]];
attributes = [set allObjects];
}
return attributes;
}
- (id)accessibilityAttributeValue:(NSString*)attribute
{
if([attribute isEqualToString:NSAccessibilityRoleAttribute])
return NSAccessibilityGroupRole;
else if([attribute isEqualToString:NSAccessibilityDescriptionAttribute])
return @"Editor";
else
return [super accessibilityAttributeValue:attribute];
}
@end