Bug 1680589: Make AXDisclosing settable on outline rows r=eeejay

Differential Revision: https://phabricator.services.mozilla.com/D101053
This commit is contained in:
Morgan Reschenberg 2021-01-07 21:29:27 +00:00
Родитель 1434deba5f
Коммит 29a8164b84
4 изменённых файлов: 43 добавлений и 0 удалений

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

@ -307,6 +307,9 @@
#pragma mark - AttributeSetters
// AXDisclosing
- (void)moxSetDisclosing:(NSNumber* _Nullable)disclosing;
// AXValue
- (void)moxSetValue:(id _Nullable)value;

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

@ -138,6 +138,9 @@
// override
- (NSNumber*)moxDisclosing;
// override
- (void)moxSetDisclosing:(NSNumber*)disclosing;
// override
- (NSNumber*)moxExpanded;

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

@ -461,6 +461,14 @@ using namespace mozilla::a11y;
return @([self stateWithMask:states::EXPANDED] != 0);
}
- (void)moxSetDisclosing:(NSNumber*)disclosing {
// VoiceOver requires this to be settable, but doesn't
// require it actually affect our disclosing state.
// We expose the attr as settable with this method
// but do nothing to actually set it.
return;
}
- (NSNumber*)moxExpanded {
return @([self stateWithMask:states::EXPANDED] != 0);
}

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

@ -402,3 +402,32 @@ addAccessibleTask(
);
}
);
// Test outline registers AXDisclosed attr as settable
addAccessibleTask(
`
<div role="tree" id="tree" tabindex="0" aria-label="My drive" aria-activedescendant="myfiles">
<div id="myfiles" role="treeitem" aria-label="My files" aria-selected="true" aria-expanded="false">My files</div>
<div role="treeitem" aria-label="Shared items" aria-selected="false" aria-expanded="true">Shared items</div>
</div>
`,
async (browser, accDoc) => {
const tree = getNativeInterface(accDoc, "tree");
const treeItems = tree.getAttributeValue("AXChildren");
is(treeItems.length, 2, "Outline has two direct children");
is(treeItems[0].getAttributeValue("AXDisclosing"), 0);
is(treeItems[1].getAttributeValue("AXDisclosing"), 1);
is(treeItems[0].isAttributeSettable("AXDisclosing"), true);
is(treeItems[1].isAttributeSettable("AXDisclosing"), true);
// attempt to change attribute values
treeItems[0].setAttributeValue("AXDisclosing", 1);
treeItems[0].setAttributeValue("AXDisclosing", 0);
// verify they're unchanged
is(treeItems[0].getAttributeValue("AXDisclosing"), 0);
is(treeItems[1].getAttributeValue("AXDisclosing"), 1);
}
);