Bug 1266134 - Prevent browser_computed_keybindings_01.js from opening options panel. r=jryans
authorAlexandre Poirot <poirot.alex@gmail.com>
Thu, 15 Sep 2016 15:08:11 -0700
changeset 350483 2268d466af6cbf62fc48006d3ff00d087c339e8b
parent 350482 0b6042ee4d0325dadca719383175a46c2e9db6fe
child 350484 54f7bdea89765bb113513f00000160f4dd25c317
child 350526 3765535641d5753ae3a67d8c08bd76f6ec07776a
push id13
push userfmarier@mozilla.com
push dateFri, 11 Nov 2016 01:36:56 +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
@@ -934,16 +934,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);
 
@@ -1165,18 +1168,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;
 }