Bug 1680277 - 3/3: Use AXTextArea for multiline and aria text boxes. r=morgan

By spec, it would need to be an area for aria-multiline=true and a field for aria-multiline=false. Chrome seems to assign all aria text boxes to areas. For some reason this allows VO to recognize links when editing. Webkit doesn't need this, for some reason and can get links announces in AXTextField as well.

Depends on D99312

Differential Revision: https://phabricator.services.mozilla.com/D99313
This commit is contained in:
Eitan Isaacson 2020-12-10 19:00:05 +00:00
Родитель d19edae3f4
Коммит 64d2a266cd
5 изменённых файлов: 27 добавлений и 2 удалений

Просмотреть файл

@ -111,6 +111,9 @@ inline mozAccessible* GetNativeFromGeckoAccessible(
// Handle a role change
- (void)handleRoleChanged:(mozilla::a11y::role)newRole;
// Get ARIA role
- (nsStaticAtom*)ARIARole;
#pragma mark - mozAccessible protocol / widget
// override

Просмотреть файл

@ -41,8 +41,6 @@ using namespace mozilla::a11y;
@interface mozAccessible ()
- (BOOL)providesLabelNotTitle;
- (nsStaticAtom*)ARIARole;
- (void)maybePostLiveRegionChanged;
@end

Просмотреть файл

@ -24,6 +24,9 @@
// override
- (NSNumber*)moxInsertionPointLineNumber;
// override
- (NSString*)moxRole;
// override
- (NSString*)moxSubrole;

Просмотреть файл

@ -134,6 +134,15 @@ inline NSString* ToNSString(id aValue) {
return (lineNumber >= 0) ? [NSNumber numberWithInt:lineNumber] : nil;
}
- (NSString*)moxRole {
if ([self ARIARole] == nsGkAtoms::textbox ||
[self stateWithMask:states::MULTI_LINE]) {
return NSAccessibilityTextAreaRole;
}
return [super moxRole];
}
- (NSString*)moxSubrole {
MOZ_ASSERT(!mGeckoAccessible.IsNull());

Просмотреть файл

@ -73,6 +73,12 @@ addAccessibleTask(
<div id="timer" role="timer"></div>
<div id="tooltip" role="tooltip"></div>
<!-- text entries -->
<div id="textbox_multiline" role="textbox" aria-multiline="true"></div>
<div id="textbox_singleline" role="textbox" aria-multiline="false"></div>
<textarea id="textArea"></textarea>
<input id="textInput">
<!-- True HTML5 search box -->
<input type="search" id="htmlSearch" />
@ -175,6 +181,12 @@ addAccessibleTask(
testRoleAndSubRole(accDoc, "timer", null, "AXApplicationTimer");
testRoleAndSubRole(accDoc, "tooltip", "AXGroup", "AXUserInterfaceTooltip");
// Text boxes
testRoleAndSubRole(accDoc, "textbox_multiline", "AXTextArea");
testRoleAndSubRole(accDoc, "textbox_singleline", "AXTextArea");
testRoleAndSubRole(accDoc, "textArea", "AXTextArea");
testRoleAndSubRole(accDoc, "textInput", "AXTextField");
// True HTML5 search field
testRoleAndSubRole(accDoc, "htmlSearch", "AXTextField", "AXSearchField");