зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1625953 - P2: Introduce support for aria-controls and aria-flowto in mac. r=morgan
This is via AXARIAControls and AXLinkedUIElements respectively. Differential Revision: https://phabricator.services.mozilla.com/D101085
This commit is contained in:
Родитель
515ee847be
Коммит
a5ce58cf1a
|
@ -127,6 +127,12 @@
|
|||
// AXElementBusy
|
||||
- (NSNumber* _Nullable)moxElementBusy;
|
||||
|
||||
// AXLinkedUIElements
|
||||
- (NSArray* _Nullable)moxLinkedUIElements;
|
||||
|
||||
// AXARIAControls
|
||||
- (NSArray* _Nullable)moxARIAControls;
|
||||
|
||||
// AXDOMIdentifier
|
||||
- (NSString* _Nullable)moxDOMIdentifier;
|
||||
|
||||
|
|
|
@ -215,6 +215,12 @@ inline mozAccessible* GetNativeFromGeckoAccessible(
|
|||
// override
|
||||
- (NSNumber*)moxElementBusy;
|
||||
|
||||
// override
|
||||
- (NSArray*)moxLinkedUIElements;
|
||||
|
||||
// override
|
||||
- (NSArray*)moxARIAControls;
|
||||
|
||||
// override
|
||||
- (id)moxEditableAncestor;
|
||||
|
||||
|
|
|
@ -771,6 +771,14 @@ struct RoleDescrComparator {
|
|||
return @([self stateWithMask:states::BUSY] != 0);
|
||||
}
|
||||
|
||||
- (NSArray*)moxLinkedUIElements {
|
||||
return [self getRelationsByType:RelationType::FLOWS_TO];
|
||||
}
|
||||
|
||||
- (NSArray*)moxARIAControls {
|
||||
return [self getRelationsByType:RelationType::CONTROLLER_FOR];
|
||||
}
|
||||
|
||||
- (mozAccessible*)topWebArea {
|
||||
AccessibleOrProxy doc = [self geckoDocument];
|
||||
while (!doc.IsNull()) {
|
||||
|
|
|
@ -48,7 +48,10 @@
|
|||
|
||||
// Accessible for a radio button
|
||||
@interface mozRadioButtonAccessible : mozCheckboxAccessible
|
||||
- (id)accessibilityAttributeValue:(NSString*)attribute;
|
||||
|
||||
// override
|
||||
- (NSArray*)moxLinkedUIElements;
|
||||
|
||||
@end
|
||||
|
||||
/**
|
||||
|
|
|
@ -81,19 +81,9 @@ enum CheckboxValue {
|
|||
|
||||
@implementation mozRadioButtonAccessible
|
||||
|
||||
- (id)accessibilityAttributeValue:(NSString*)attribute {
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||
if ([self isExpired]) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
if ([attribute isEqualToString:NSAccessibilityLinkedUIElementsAttribute]) {
|
||||
return [self getRelationsByType:RelationType::MEMBER_OF];
|
||||
}
|
||||
|
||||
return [super accessibilityAttributeValue:attribute];
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||
- (NSArray*)moxLinkedUIElements {
|
||||
return [[self getRelationsByType:RelationType::MEMBER_OF]
|
||||
arrayByAddingObjectsFromArray:[super moxLinkedUIElements]];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -47,3 +47,4 @@ skip-if = os == 'mac' && debug # Bug 1664577
|
|||
[browser_rich_listbox.js]
|
||||
[browser_live_regions.js]
|
||||
[browser_aria_busy.js]
|
||||
[browser_aria_controls_flowto.js]
|
|
@ -0,0 +1,84 @@
|
|||
/* 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-controls
|
||||
*/
|
||||
addAccessibleTask(
|
||||
`<button aria-controls="info" id="info-button">Show info</button>
|
||||
<div id="info">Information.</div>
|
||||
<div id="more-info">More information.</div>`,
|
||||
async (browser, accDoc) => {
|
||||
const isARIAControls = (id, expectedIds) =>
|
||||
Assert.deepEqual(
|
||||
getNativeInterface(accDoc, id)
|
||||
.getAttributeValue("AXARIAControls")
|
||||
.map(e => e.getAttributeValue("AXDOMIdentifier")),
|
||||
expectedIds,
|
||||
`"${id}" has correct AXARIAControls`
|
||||
);
|
||||
|
||||
isARIAControls("info-button", ["info"]);
|
||||
|
||||
await SpecialPowers.spawn(browser, [], () => {
|
||||
content.document
|
||||
.getElementById("info-button")
|
||||
.setAttribute("aria-controls", "info more-info");
|
||||
});
|
||||
|
||||
isARIAControls("info-button", ["info", "more-info"]);
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* Test aria-flowto
|
||||
*/
|
||||
addAccessibleTask(
|
||||
`<button aria-flowto="info" id="info-button">Show info</button>
|
||||
<div id="info">Information.</div>
|
||||
<div id="more-info">More information.</div>`,
|
||||
async (browser, accDoc) => {
|
||||
const isLinkedUIElements = (id, expectedIds) =>
|
||||
Assert.deepEqual(
|
||||
getNativeInterface(accDoc, id)
|
||||
.getAttributeValue("AXLinkedUIElements")
|
||||
.map(e => e.getAttributeValue("AXDOMIdentifier")),
|
||||
expectedIds,
|
||||
`"${id}" has correct AXARIAControls`
|
||||
);
|
||||
|
||||
isLinkedUIElements("info-button", ["info"]);
|
||||
|
||||
await SpecialPowers.spawn(browser, [], () => {
|
||||
content.document
|
||||
.getElementById("info-button")
|
||||
.setAttribute("aria-flowto", "info more-info");
|
||||
});
|
||||
|
||||
isLinkedUIElements("info-button", ["info", "more-info"]);
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* Test aria-controls
|
||||
*/
|
||||
addAccessibleTask(
|
||||
`<input type="radio" id="cat-radio" name="animal"><label for="cat">Cat</label>
|
||||
<input type="radio" id="dog-radio" name="animal" aria-flowto="info"><label for="dog">Dog</label>
|
||||
<div id="info">Information.</div>`,
|
||||
async (browser, accDoc) => {
|
||||
const isLinkedUIElements = (id, expectedIds) =>
|
||||
Assert.deepEqual(
|
||||
getNativeInterface(accDoc, id)
|
||||
.getAttributeValue("AXLinkedUIElements")
|
||||
.map(e => e.getAttributeValue("AXDOMIdentifier")),
|
||||
expectedIds,
|
||||
`"${id}" has correct AXARIAControls`
|
||||
);
|
||||
|
||||
isLinkedUIElements("dog-radio", ["cat-radio", "dog-radio", "info"]);
|
||||
}
|
||||
);
|
Загрузка…
Ссылка в новой задаче