Bug 1190368 - Suppress a11y focus event when UnifiedComplete is enabled and the urlbar popup's first item is selected. r=mak a=sylvestre
authorDrew Willcoxon <adw@mozilla.com>
Wed, 02 Sep 2015 11:44:23 -0700
changeset 289114 5133f5c9fff0294fab5291c2960eb17768169c03
parent 289113 dedd83e6d52615d30eacc318db9e9a33d6318079
child 289115 e714be378aa48b5215ef0c373e6d7a1236d8c7d1
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak, sylvestre
bugs1190368
milestone42.0a2
Bug 1190368 - Suppress a11y focus event when UnifiedComplete is enabled and the urlbar popup's first item is selected. r=mak a=sylvestre
browser/base/content/urlbarBindings.xml
toolkit/content/widgets/listbox.xml
--- a/browser/base/content/urlbarBindings.xml
+++ b/browser/base/content/urlbarBindings.xml
@@ -1855,17 +1855,23 @@ file, You can obtain one at http://mozil
 
             // If nothing is selected yet, select the first result if it is a
             // pre-selected "heuristic" result.  (See UnifiedComplete.js.)
             if (this._matchCount > 0 && this.selectedIndex == -1) {
               let styles = this.input.mController.getStyleAt(0).split(/\s+/);
               if (styles.indexOf("heuristic") >= 0) {
                 // Don't handle this as a user-initiated action.
                 this._ignoreNextSelect = true;
+
+                // Don't fire DOMMenuItemActive so that screen readers still see
+                // the input as being focused.
+                this.richlistbox.suppressMenuItemEvent = true;
+
                 this.selectedIndex = 0;
+                this.richlistbox.suppressMenuItemEvent = false;
                 this._ignoreNextSelect = false;
               }
             }
 
             this.input.gotResultForCurrentQuery = true;
             if (this.input.handleEnterWhenGotResult) {
               this.input.handleEnterWhenGotResult = false;
               this.input.mController.handleEnter(false);
--- a/toolkit/content/widgets/listbox.xml
+++ b/toolkit/content/widgets/listbox.xml
@@ -908,17 +908,20 @@
     <implementation implements="nsIDOMXULSelectControlItemElement">
       <property name="current" onget="return this.getAttribute('current') == 'true';">
         <setter><![CDATA[
           if (val)
             this.setAttribute("current", "true");
           else
             this.removeAttribute("current");
 
-          this._fireEvent(val ? "DOMMenuItemActive" : "DOMMenuItemInactive");
+          let control = this.control;
+          if (!control || !control.suppressMenuItemEvent) {
+            this._fireEvent(val ? "DOMMenuItemActive" : "DOMMenuItemInactive");
+          }
 
           return val;
         ]]></setter>
       </property>
 
       <!-- ///////////////// nsIDOMXULSelectControlItemElement ///////////////// -->
                 
       <property name="value" onget="return this.getAttribute('value');"