Bug 1838502 - Don't expose a title for labels. r=morgan
THis is what VO expects, we apparently knew that but decided it wasn't worth fixing in the past Differential Revision: https://phabricator.services.mozilla.com/D244050
This commit is contained in:
@@ -307,6 +307,9 @@ Class a11y::GetTypeFromRole(roles::Role aRole) {
|
|||||||
case roles::OUTLINEITEM:
|
case roles::OUTLINEITEM:
|
||||||
return [mozOutlineRowAccessible class];
|
return [mozOutlineRowAccessible class];
|
||||||
|
|
||||||
|
case roles::LABEL:
|
||||||
|
return [MOXLabelAccessible class];
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return [mozAccessible class];
|
return [mozAccessible class];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -887,22 +887,19 @@ struct RoleDescrComparator {
|
|||||||
: nullptr;
|
: nullptr;
|
||||||
if (maybeRoot && maybeRoot->IsRoot() &&
|
if (maybeRoot && maybeRoot->IsRoot() &&
|
||||||
[[self moxDOMIdentifier] isEqualToString:@"a11y-announcement"]) {
|
[[self moxDOMIdentifier] isEqualToString:@"a11y-announcement"]) {
|
||||||
// Our actual announcement should be stored as a child of the alert,
|
nsAutoString name;
|
||||||
// so we verify a child exists, and then query that child below.
|
// Our actual announcement should be stored as a child of the alert.
|
||||||
NSArray* children = [self moxChildren];
|
if (Accessible* announcement = mGeckoAccessible->FirstChild()) {
|
||||||
MOZ_ASSERT([children count] == 1 && children[0],
|
announcement->Name(name);
|
||||||
"A11yUtil event received, but no announcement found?");
|
|
||||||
|
|
||||||
mozAccessible* announcement = children[0];
|
|
||||||
NSString* key;
|
|
||||||
if ([announcement providesLabelNotTitle]) {
|
|
||||||
key = [announcement moxLabel];
|
|
||||||
} else {
|
} else {
|
||||||
key = [announcement moxTitle];
|
MOZ_ASSERT_UNREACHABLE(
|
||||||
|
"A11yUtil event received, but no announcement found?");
|
||||||
}
|
}
|
||||||
|
|
||||||
NSDictionary* info = @{
|
NSDictionary* info = @{
|
||||||
NSAccessibilityAnnouncementKey : key ? key : @(""),
|
NSAccessibilityAnnouncementKey : name.IsEmpty()
|
||||||
|
? @("")
|
||||||
|
: nsCocoaUtils::ToNSString(name),
|
||||||
// High priority means VO will stop what it is currently speaking
|
// High priority means VO will stop what it is currently speaking
|
||||||
// to speak our announcement.
|
// to speak our announcement.
|
||||||
NSAccessibilityPriorityKey : @(NSAccessibilityPriorityHigh)
|
NSAccessibilityPriorityKey : @(NSAccessibilityPriorityHigh)
|
||||||
|
|||||||
@@ -42,3 +42,10 @@
|
|||||||
- (NSString*)moxTitle;
|
- (NSString*)moxTitle;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@interface MOXLabelAccessible : mozAccessible
|
||||||
|
|
||||||
|
// override
|
||||||
|
- (NSString*)moxTitle;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|||||||
@@ -81,3 +81,11 @@ using namespace mozilla::a11y;
|
|||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@implementation MOXLabelAccessible
|
||||||
|
|
||||||
|
- (NSString*)moxTitle {
|
||||||
|
return @"";
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ addAccessibleTask(
|
|||||||
let n1 = getNativeInterface(accDoc, "n1");
|
let n1 = getNativeInterface(accDoc, "n1");
|
||||||
let n1Label = n1.getAttributeValue("AXTitleUIElement");
|
let n1Label = n1.getAttributeValue("AXTitleUIElement");
|
||||||
// XXX: In Safari the label is an AXText with an AXValue,
|
// XXX: In Safari the label is an AXText with an AXValue,
|
||||||
// here it is an AXGroup witth an AXTitle
|
// we emulate that so VoiceOver does not speak the label twice.
|
||||||
is(n1Label.getAttributeValue("AXTitle"), "Label");
|
is(n1Label.getAttributeValue("AXTitle"), "");
|
||||||
|
|
||||||
let n2 = getNativeInterface(accDoc, "n2");
|
let n2 = getNativeInterface(accDoc, "n2");
|
||||||
is(n2.getAttributeValue("AXDescription"), "Two Labels");
|
is(n2.getAttributeValue("AXDescription"), "Two Labels");
|
||||||
|
|||||||
Reference in New Issue
Block a user