Bug 1326821: about:preferences - Ctrl+K shortcut doesn't focus searchbar. r=Gijs

MozReview-Commit-ID: 3zNwW2b4K17

--HG--
extra : rebase_source : 667479b4a01ff33a75297513e1cb475b133538e3
This commit is contained in:
Steffen Wilberg 2017-01-15 22:00:58 +01:00
Родитель 2742e01a90
Коммит fda333b194
4 изменённых файлов: 26 добавлений и 5 удалений

Просмотреть файл

@ -52,8 +52,9 @@
type="bool"/>
</preferences>
<keyset>
<!-- These <key>s have oncommand attributes because of bug 371900 -->
<keyset data-category="paneApplications">
<!-- Ctrl+f/k focus the search box in the Applications pane.
These <key>s have oncommand attributes because of bug 371900. -->
<key key="&focusSearch1.key;" modifiers="accel" id="focusSearch1" oncommand=";"/>
<key key="&focusSearch2.key;" modifiers="accel" id="focusSearch2" oncommand=";"/>
</keyset>

Просмотреть файл

@ -200,11 +200,21 @@ function gotoPref(aCategory) {
}
function search(aQuery, aAttribute) {
let elements = document.getElementById("mainPrefPane").children;
let mainPrefPane = document.getElementById("mainPrefPane");
let elements = mainPrefPane.children;
for (let element of elements) {
let attributeValue = element.getAttribute(aAttribute);
element.hidden = (attributeValue != aQuery);
}
let keysets = mainPrefPane.getElementsByTagName("keyset");
for (let element of keysets) {
let attributeValue = element.getAttribute(aAttribute);
if (attributeValue == aQuery)
element.removeAttribute("disabled");
else
element.setAttribute("disabled", true);
}
}
function helpButtonCommand() {

Просмотреть файл

@ -61,6 +61,7 @@
<page xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
disablefastfind="true"
#ifdef USE_WIN_TITLE_STYLE
title="&prefWindow.titleWin;">
#else
@ -178,6 +179,13 @@
</richlistitem>
</richlistbox>
<keyset>
<!-- Disable the findbar because it doesn't work properly.
Remove this keyset once bug 1094240 ("disablefastfind" attribute
broken in e10s mode) is fixed. -->
<key key="&focusSearch1.key;" modifiers="accel" id="focusSearch1" oncommand=";"/>
</keyset>
<vbox class="main-content" flex="1">
<prefpane id="mainPrefPane">
#include main.xul

Просмотреть файл

@ -13,9 +13,11 @@ var gElements;
function checkElements(expectedPane) {
for (let element of gElements) {
// preferences elements fail is_element_visible checks because they are never visible.
// keyset and preferences elements fail is_element_visible checks because they are never visible.
// special-case the drmGroup item because its visibility depends on pref + OS version
if (element.nodeName == "preferences" || element.id === "drmGroup") {
if (element.nodeName == "keyset" ||
element.nodeName == "preferences" ||
element.id === "drmGroup") {
continue;
}
let attributeValue = element.getAttribute("data-category");