Bug 1266134 - Prevent browser_computed_keybindings_01.js from opening options panel. r=jryans draft
authorAlexandre Poirot <poirot.alex@gmail.com>
Thu, 15 Sep 2016 15:08:11 -0700
changeset 422068 4a5651142356b30de690bb449b862dde7425a41f
parent 422067 ccf8328bae265257ef6d9790a51514b3a7bbabe0
child 533244 1ff075d769b0f5e85f923f766ac681d1ead51a48
push id31675
push userbmo:poirot.alex@gmail.com
push dateFri, 07 Oct 2016 09:37:23 +0000
reviewersjryans
bugs1266134
milestone52.0a1
Bug 1266134 - Prevent browser_computed_keybindings_01.js from opening options panel. r=jryans MozReview-Commit-ID: LXCWjQwkwUN
devtools/client/inspector/computed/computed.js
devtools/client/inspector/computed/test/browser_computed_keybindings_01.js
--- a/devtools/client/inspector/computed/computed.js
+++ b/devtools/client/inspector/computed/computed.js
@@ -919,16 +919,19 @@ PropertyView.prototype = {
     // Make it keyboard navigable
     this.element.setAttribute("tabindex", "0");
     this.shortcuts = new KeyShortcuts({
       window: this.tree.styleWindow,
       target: this.element
     });
     this.shortcuts.on("F1", (name, event) => {
       this.mdnLinkClick(event);
+      // Prevent opening the options panel
+      event.preventDefault();
+      event.stopPropagation();
     });
     this.shortcuts.on("Return", (name, event) => this.onMatchedToggle(event));
     this.shortcuts.on("Space", (name, event) => this.onMatchedToggle(event));
 
     let nameContainer = doc.createElementNS(HTML_NS, "div");
     nameContainer.className = "property-name-container";
     this.element.appendChild(nameContainer);
 
@@ -1150,18 +1153,16 @@ PropertyView.prototype = {
    */
   mdnLinkClick: function (event) {
     let inspector = this.tree.inspector;
 
     if (inspector.target.tab) {
       let browserWin = inspector.target.tab.ownerDocument.defaultView;
       browserWin.openUILinkIn(this.link, "tab");
     }
-    event.preventDefault();
-    event.stopPropagation();
   },
 
   /**
    * Destroy this property view, removing event listeners
    */
   destroy: function () {
     this.element.removeEventListener("dblclick", this.onMatchedToggle, false);
     this.shortcuts.destroy();
--- a/devtools/client/inspector/computed/test/browser_computed_keybindings_01.js
+++ b/devtools/client/inspector/computed/test/browser_computed_keybindings_01.js
@@ -68,16 +68,16 @@ function* checkToggleKeyBinding(win, key
   is(rulesTable.innerHTML, "", "The property has been collapsed");
 }
 
 function checkHelpLinkKeybinding(view) {
   info("Check that MDN link is opened on \"F1\"");
   let def = defer();
 
   let propView = getFirstVisiblePropertyView(view);
-  propView.mdnLinkClick = function () {
+  propView.mdnLinkClick = function (event) {
     ok(true, "Pressing F1 opened the MDN link");
     def.resolve();
   };
 
   EventUtils.synthesizeKey("VK_F1", {}, view.styleWindow);
   return def.promise;
 }