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 421765 d911b8d25a21c81d71f4c1e792d33599566d4317
parent 421764 0a861032b1a6b402f958b53b619ed889624aac36
child 533166 9047158a4a8203296b7ddb308be0f41faf79eb76
push id31594
push userbmo:poirot.alex@gmail.com
push dateThu, 06 Oct 2016 21:06:20 +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;
 }