Bug 1862999 - Introduce support for AXARIAPosInSet and AXARIASetSize. r=morgan

Differential Revision: https://phabricator.services.mozilla.com/D192887
This commit is contained in:
Eitan Isaacson 2023-11-07 22:24:23 +00:00
parent 88d846bbb8
commit 95dcf00cc5
5 changed files with 77 additions and 0 deletions

View file

@ -261,6 +261,12 @@
// AXSelectedRows
- (NSArray* _Nullable)moxSelectedRows;
// AXARIAPosInSet
- (NSNumber* _Nullable)moxARIAPosInSet;
// AXARIASetSize
- (NSNumber* _Nullable)moxARIASetSize;
// Math Attributes
// AXMathRootRadicand

View file

@ -206,6 +206,12 @@ enum CheckedState {
// override
- (NSString*)moxARIALive;
// override
- (NSNumber*)moxARIAPosInSet;
// override
- (NSNumber*)moxARIASetSize;
// override
- (NSString*)moxARIARelevant;

View file

@ -159,6 +159,12 @@ using namespace mozilla::a11y;
return ![self moxIsLiveRegion];
}
if (selector == @selector(moxARIAPosInSet) || selector == @selector
(moxARIASetSize)) {
GroupPos groupPos = mGeckoAccessible->GroupPosition();
return groupPos.setSize == 0;
}
if (selector == @selector(moxExpanded)) {
return [self stateWithMask:states::EXPANDABLE] == 0;
}
@ -620,6 +626,16 @@ struct RoleDescrComparator {
return utils::GetAccAttr(self, nsGkAtoms::aria_live);
}
- (NSNumber*)moxARIAPosInSet {
GroupPos groupPos = mGeckoAccessible->GroupPosition();
return @(groupPos.posInSet);
}
- (NSNumber*)moxARIASetSize {
GroupPos groupPos = mGeckoAccessible->GroupPosition();
return @(groupPos.setSize);
}
- (NSString*)moxARIARelevant {
if (NSString* relevant =
utils::GetAccAttr(self, nsGkAtoms::containerRelevant)) {

View file

@ -29,6 +29,8 @@ https_first_disabled = true
["browser_aria_haspopup.js"]
["browser_aria_setsize.js"]
["browser_attributed_text.js"]
["browser_bounds.js"]

View file

@ -0,0 +1,47 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
/**
* Test aria-setsize and aria-posinset
*/
addAccessibleTask(
`<div role="listbox" id="select" aria-label="Choose a number">
<div role="option" id="two" aria-setsize="5" aria-posinset="2">Two</div>
<div role="option" id="three" aria-setsize="5" aria-posinset="3">Three</div>
<div role="option" id="four" aria-setsize="5" aria-posinset="4">Four</div>
</div>
<p id="p">Hello</p>`,
async (browser, accDoc) => {
function testPosInSet(id, setsize, posinset) {
let elem = getNativeInterface(accDoc, id);
is(
elem.getAttributeValue("AXARIASetSize"),
setsize,
`${id}: Correct set size`
);
is(
elem.getAttributeValue("AXARIAPosInSet"),
posinset,
`${id}: Correct position in set`
);
}
testPosInSet("two", 5, 2);
testPosInSet("three", 5, 3);
testPosInSet("four", 5, 4);
let p = getNativeInterface(accDoc, "p");
ok(
!p.attributeNames.includes("AXARIASetSize"),
"Paragraph should not have AXARIASetSize"
);
ok(
!p.attributeNames.includes("AXARIAPosInSet"),
"Paragraph should not have AXARIAPosInSet"
);
}
);