Bug 1639623 - Support AXPress on radio buttons and remove action description. r=morgan
authorEitan Isaacson <eitan@monotonous.org>
Wed, 20 May 2020 23:48:30 +0000
changeset 531354 17c8b0e564637546efa3291f173253841c184f1b
parent 531353 ce69a90afaa52ec1c8269c3d84b8a610ef67d854
child 531355 1afd7205a9f3d9c61ba847dd7769543ad8befeaa
push id37438
push userabutkovits@mozilla.com
push dateThu, 21 May 2020 09:36:57 +0000
treeherdermozilla-central@2d00a1a6495c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmorgan
bugs1639623
milestone78.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1639623 - Support AXPress on radio buttons and remove action description. r=morgan Differential Revision: https://phabricator.services.mozilla.com/D76175
accessible/mac/mozAccessible.mm
accessible/mac/mozActionElements.mm
accessible/tests/browser/mac/browser_toggle_radio_check.js
--- a/accessible/mac/mozAccessible.mm
+++ b/accessible/mac/mozAccessible.mm
@@ -597,28 +597,20 @@ static const uint64_t kCacheInitialized 
     count = accWrap->ActionCount();
   } else if (proxy) {
     count = proxy->ActionCount();
   }
 
   // Check if the accessible has an existing gecko
   // action, and add the corresponding Mac action to
   // the actions array. `count` is guaranteed to be 0 or 1
+  // If an action exists, add a "AXPress" action
+  // to our native object.
   if (count) {
-    nsAutoString name;
-    if (accWrap) {
-      accWrap->ActionNameAt(0, name);
-    } else if (proxy) {
-      proxy->ActionNameAt(0, name);
-    }
-    if (name.EqualsLiteral("select")) {
-      [actions addObject:NSAccessibilityPickAction];
-    } else {
-      [actions addObject:NSAccessibilityPressAction];
-    }
+    [actions addObject:NSAccessibilityPressAction];
   }
 
   // Regardless of `count`, add actions that should be
   // performable on all accessibles. If we added a press
   // action, it will be first in the list. We append other
   // actions here to maintain that invariant.
   [actions addObject:NSAccessibilityScrollToVisibleAction];
   [actions addObject:NSAccessibilityShowMenuAction];
--- a/accessible/mac/mozActionElements.mm
+++ b/accessible/mac/mozActionElements.mm
@@ -152,30 +152,16 @@ enum CheckboxValue {
 
   return [super ignoreWithParent:parent];
 }
 
 @end
 
 @implementation mozCheckboxAccessible
 
-- (NSString*)accessibilityActionDescription:(NSString*)action {
-  NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
-
-  if ([action isEqualToString:NSAccessibilityPressAction]) {
-    if ([self isChecked] != kUnchecked) return @"uncheck checkbox";  // XXX: localize this later?
-
-    return @"check checkbox";  // XXX: localize this later?
-  }
-
-  return nil;
-
-  NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
-}
-
 - (int)isChecked {
   // check if we're checked or in a mixed state
   uint64_t state = [self stateWithMask:(states::CHECKED | states::PRESSED | states::MIXED)];
   if (state & (states::CHECKED | states::PRESSED)) {
     return kChecked;
   }
 
   if (state & states::MIXED) {
--- a/accessible/tests/browser/mac/browser_toggle_radio_check.js
+++ b/accessible/tests/browser/mac/browser_toggle_radio_check.js
@@ -105,20 +105,20 @@ addAccessibleTask(
     let dewey = getNativeInterface(accDoc, "dewey");
     is(
       dewey.getAttributeValue("AXValue"),
       0,
       "Correct initial value for dewey"
     );
 
     let actions = dewey.actionNames;
-    ok(actions.includes("AXPick"), "Has pick action");
+    ok(actions.includes("AXPress"), "Has press action");
 
     let stateChanged = waitForEvent(EVENT_STATE_CHANGE, "huey");
-    dewey.performAction("AXPick");
+    dewey.performAction("AXPress");
     await stateChanged;
     is(
       dewey.getAttributeValue("AXValue"),
       1,
       "Correct checked value for dewey"
     );
     is(huey.getAttributeValue("AXValue"), 0, "Correct checked value for huey");
   }