Bug 1623399 - Hide chrome invisible alerts and dialogs. r=morgan
authorEitan Isaacson <eitan@monotonous.org>
Wed, 25 Mar 2020 21:29:43 +0000
changeset 520440 1dcf0f0c9300f2385ab5b33b102a9a41d7686183
parent 520439 336b2dd5c282f9a45509edff8c919718552bcf42
child 520441 22baf134cf80a5aecee934132f3961fd7b7777ce
push id37250
push userdvarga@mozilla.com
push dateThu, 26 Mar 2020 04:04:15 +0000
treeherdermozilla-central@85bae8580dde [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmorgan
bugs1623399
milestone76.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 1623399 - Hide chrome invisible alerts and dialogs. r=morgan Differential Revision: https://phabricator.services.mozilla.com/D68272
accessible/mac/mozRootAccessible.mm
--- a/accessible/mac/mozRootAccessible.mm
+++ b/accessible/mac/mozRootAccessible.mm
@@ -79,22 +79,26 @@ static id<mozAccessible, mozView> getNat
 
 - (NSArray*)children {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
 
   return [[super children]
       filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(mozAccessible* child,
                                                                         NSDictionary* bindings) {
         AccessibleWrap* childAcc = [child getGeckoAccessible];
-        if (childAcc && childAcc->Role() == roles::MENUPOPUP &&
-            ((childAcc->VisibilityState() & states::INVISIBLE) != 0)) {
-          // Filter out all invisible XUL popup menus. Invisible elements in our browser
-          // chrome are unique in the sense that we want screen readers to ignore them.
-          // These only exist in the top level process so we don't do a similar check on proxies.
-          return NO;
+        if (childAcc) {
+          role r = childAcc->Role();
+          if ((r == roles::MENUPOPUP || r == roles::DIALOG || r == roles::ALERT) &&
+              ((childAcc->VisibilityState() & states::INVISIBLE) != 0)) {
+            // Filter out all invisible XUL popup menus, dialogs and alerts. Invisible elements in
+            // our browser chrome are unique in the sense that we want screen readers to ignore
+            // them. These only exist in the top level process so we don't do a similar check on
+            // proxies.
+            return NO;
+          }
         }
 
         return YES;
       }]];
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
 }