Bug 1266134 - Prevent browser_computed_keybindings_01.js from opening options panel. r=jryans
MozReview-Commit-ID: LXCWjQwkwUN
--- 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;
}