Bug 1534661 - Fix the QuantumBar results view to have an accessible role of ROLE_COMBOBOX_LIST. r=dao
authorMark Banner <standard8@mozilla.com>
Fri, 15 Mar 2019 16:43:11 +0000
changeset 525073 e05c19c17c88d69bbad0646b3839564a082179a3
parent 525072 3bac6d709aac4105cf228ddd11f9f68711288f1a
child 525074 4b6ece1be5c2d4a095c42cf76bdc42120f0da872
push id2032
push userffxbld-merge
push dateMon, 13 May 2019 09:36:57 +0000
treeherdermozilla-release@455c1065dcbe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdao
bugs1534661
milestone67.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 1534661 - Fix the QuantumBar results view to have an accessible role of ROLE_COMBOBOX_LIST. r=dao Differential Revision: https://phabricator.services.mozilla.com/D23155
accessible/tests/browser/general/browser_test_urlbar.js
browser/components/urlbar/UrlbarInput.jsm
--- a/accessible/tests/browser/general/browser_test_urlbar.js
+++ b/accessible/tests/browser/general/browser_test_urlbar.js
@@ -1,34 +1,38 @@
 /* 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";
 
+const {UrlbarTestUtils} = ChromeUtils.import("resource://testing-common/UrlbarTestUtils.jsm");
+
 // Checking that the awesomebar popup gets COMBOBOX_LIST role instead of
 // LISTBOX, since its parent is a <panel> (see Bug 1422465)
 add_task(async function testAutocompleteRichResult() {
   let tab = await openNewTab("data:text/html;charset=utf-8,");
   let accService = await initAccessibilityService();
 
   info("Opening the URL bar and entering a key to show the PopupAutoCompleteRichResult panel");
-  let urlbar = document.getElementById("urlbar");
-  urlbar.focus();
-  let urlbarPopup = document.getElementById("PopupAutoCompleteRichResult");
-  let shown = BrowserTestUtils.waitForEvent(urlbarPopup, "popupshown");
-  EventUtils.sendString("a");
-  await shown;
+  await UrlbarTestUtils.promiseAutocompleteResultPopup(window, "a", waitForFocus);
 
   info("Waiting for accessibility to be created for the richlistbox");
-  let richlistbox = document.getAnonymousElementByAttribute(urlbarPopup, "anonid", "richlistbox");
-  await BrowserTestUtils.waitForCondition(() => accService.getAccessibleFor(richlistbox));
+  let resultsView;
+  if (UrlbarPrefs.get("quantumbar")) {
+    resultsView = gURLBar.view.panel.querySelector("#urlbarView-results");
+    await BrowserTestUtils.waitForCondition(() => accService.getAccessibleFor(resultsView));
+  } else {
+    let urlbarPopup = document.getElementById("PopupAutoCompleteRichResult");
+    resultsView = document.getAnonymousElementByAttribute(urlbarPopup, "anonid", "richlistbox");
+    await BrowserTestUtils.waitForCondition(() => accService.getAccessibleFor(resultsView));
+  }
 
   info("Confirming that the special case is handled in XULListboxAccessible");
-  let accessible = accService.getAccessibleFor(richlistbox);
+  let accessible = accService.getAccessibleFor(resultsView);
   is(accessible.role, ROLE_COMBOBOX_LIST, "Right role");
 
   BrowserTestUtils.removeTab(tab);
 });
 
 registerCleanupFunction(async function() {
   await shutdownAccessibilityService();
 });
--- a/browser/components/urlbar/UrlbarInput.jsm
+++ b/browser/components/urlbar/UrlbarInput.jsm
@@ -49,28 +49,31 @@ class UrlbarInput {
 
     this.window = this.textbox.ownerGlobal;
     this.document = this.window.document;
 
     // Create the panel to contain results.
     // In the future this may be moved to the view, so it can customize
     // the container element.
     let MozXULElement = this.window.MozXULElement;
+    // TODO Bug 1535659: urlbarView-body-inner possibly doesn't need the
+    // role="combobox" once bug 1513337 is fixed.
     this.document.getElementById("mainPopupSet").appendChild(
       MozXULElement.parseXULToFragment(`
         <panel id="urlbar-results"
                role="group"
                noautofocus="true"
                hidden="true"
                flip="none"
                consumeoutsideclicks="never"
                norolluponanchor="true"
                level="parent">
           <html:div class="urlbarView-body-outer">
-            <html:div class="urlbarView-body-inner">
+            <html:div class="urlbarView-body-inner"
+                      role="combobox">
               <html:div id="urlbarView-results"
                         role="listbox"/>
             </html:div>
           </html:div>
           <hbox class="search-one-offs"
                 compact="true"
                 includecurrentengine="true"
                 disabletab="true"/>