Bug 1413307 - Dispatch AXValueChanged on checkbox/radio state changes. r=MarcoZ

Differential Revision: https://phabricator.services.mozilla.com/D98260
This commit is contained in:
Eitan Isaacson 2020-12-01 09:29:56 +00:00
Родитель e1ad6a59fa
Коммит 30e07c3569
3 изменённых файлов: 28 добавлений и 2 удалений

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

@ -41,6 +41,9 @@
// override
- (id)moxValue;
// override
- (void)stateChanged:(uint64_t)state isEnabled:(BOOL)enabled;
@end
// Accessible for a radio button

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

@ -137,6 +137,14 @@ enum CheckboxValue {
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
}
- (void)stateChanged:(uint64_t)state isEnabled:(BOOL)enabled {
[super stateChanged:state isEnabled:enabled];
if (state & (states::CHECKED | states::PRESSED | states::MIXED)) {
[self moxPostNotification:NSAccessibilityValueChangedNotification];
}
}
@end
@implementation mozPaneAccessible

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

@ -23,10 +23,14 @@ addAccessibleTask(
let actions = checkbox.actionNames;
ok(actions.includes("AXPress"), "Has press action");
let evt = waitForMacEvent("AXValueChanged", "vehicle");
checkbox.performAction("AXPress");
await evt;
is(checkbox.getAttributeValue("AXValue"), 1, "Correct checked value");
evt = waitForMacEvent("AXValueChanged", "vehicle");
checkbox.performAction("AXPress");
await evt;
is(checkbox.getAttributeValue("AXValue"), 0, "Correct checked value");
}
);
@ -52,10 +56,14 @@ addAccessibleTask(
let actions = toggle.actionNames;
ok(actions.includes("AXPress"), "Has press action");
let evt = waitForMacEvent("AXValueChanged", "toggle");
toggle.performAction("AXPress");
await evt;
is(toggle.getAttributeValue("AXValue"), 1, "Correct checked value");
evt = waitForMacEvent("AXValueChanged", "toggle");
toggle.performAction("AXPress");
await evt;
is(toggle.getAttributeValue("AXValue"), 0, "Correct checked value");
}
);
@ -82,10 +90,14 @@ addAccessibleTask(
let actions = checkbox.actionNames;
ok(actions.includes("AXPress"), "Has press action");
let evt = waitForMacEvent("AXValueChanged", "checkbox");
checkbox.performAction("AXPress");
await evt;
is(checkbox.getAttributeValue("AXValue"), 1, "Correct checked value");
evt = waitForMacEvent("AXValueChanged", "checkbox");
checkbox.performAction("AXPress");
await evt;
is(checkbox.getAttributeValue("AXValue"), 2, "Correct checked value");
}
);
@ -112,9 +124,12 @@ addAccessibleTask(
let actions = dewey.actionNames;
ok(actions.includes("AXPress"), "Has press action");
let stateChanged = waitForEvent(EVENT_STATE_CHANGE, "huey");
let evt = Promise.all([
waitForMacEvent("AXValueChanged", "huey"),
waitForMacEvent("AXValueChanged", "dewey"),
]);
dewey.performAction("AXPress");
await stateChanged;
await evt;
is(
dewey.getAttributeValue("AXValue"),
1,