зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1449658 - Don't set hidden=true on items that are already visually-hidden when they don't match the search query since it is causing unnecessary layout changes. r=Gijs
MozReview-Commit-ID: 2HqpinGyuKw --HG-- extra : rebase_source : e9f7ea848e18c2d6c4e9040c5aadf15940327226
This commit is contained in:
Родитель
14b0933f4c
Коммит
f9f0b80f55
|
@ -269,7 +269,6 @@ var gSearchResultsPane = {
|
|||
if (!child.classList.contains("header") &&
|
||||
!child.classList.contains("subcategory") &&
|
||||
await this.searchWithinNode(child, this.query)) {
|
||||
child.hidden = false;
|
||||
child.classList.remove("visually-hidden");
|
||||
|
||||
// Show the preceding search-header if one exists.
|
||||
|
@ -280,8 +279,8 @@ var gSearchResultsPane = {
|
|||
}
|
||||
|
||||
resultsFound = true;
|
||||
} else if (!child.hidden) {
|
||||
child.hidden = true;
|
||||
} else {
|
||||
child.classList.add("visually-hidden");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -314,9 +313,7 @@ var gSearchResultsPane = {
|
|||
|
||||
// Hide some special second level headers in normal view
|
||||
for (let element of document.querySelectorAll("caption.search-header")) {
|
||||
if (!element.hidden) {
|
||||
element.hidden = true;
|
||||
}
|
||||
element.hidden = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -516,7 +513,7 @@ var gSearchResultsPane = {
|
|||
}
|
||||
let searchTooltip = anchorNode.ownerDocument.createElement("span");
|
||||
let searchTooltipText = anchorNode.ownerDocument.createElement("span");
|
||||
searchTooltip.setAttribute("class", "search-tooltip");
|
||||
searchTooltip.className = "search-tooltip";
|
||||
searchTooltipText.textContent = query;
|
||||
searchTooltip.appendChild(searchTooltipText);
|
||||
|
||||
|
@ -538,15 +535,11 @@ var gSearchResultsPane = {
|
|||
},
|
||||
|
||||
/**
|
||||
* Remove all search tooltips that were created.
|
||||
* Remove all search tooltips.
|
||||
*/
|
||||
removeAllSearchTooltips() {
|
||||
let searchTooltips = Array.from(document.querySelectorAll(".search-tooltip"));
|
||||
for (let searchTooltip of searchTooltips) {
|
||||
searchTooltip.parentElement.classList.remove("search-tooltip-parent");
|
||||
searchTooltip.remove();
|
||||
}
|
||||
for (let anchorNode of this.listSearchTooltips) {
|
||||
anchorNode.parentElement.classList.remove("search-tooltip-parent");
|
||||
anchorNode.tooltipNode.remove();
|
||||
anchorNode.tooltipNode = null;
|
||||
}
|
||||
|
|
|
@ -192,9 +192,7 @@ function search(aQuery, aAttribute) {
|
|||
let elements = mainPrefPane.children;
|
||||
for (let element of elements) {
|
||||
// If the "data-hidden-from-search" is "true", the
|
||||
// element will not get considered during search. This
|
||||
// should only be used when an element is still under
|
||||
// development and should not be shown for any reason.
|
||||
// element will not get considered during search.
|
||||
if (element.getAttribute("data-hidden-from-search") != "true" ||
|
||||
element.getAttribute("data-subpanel") == "true") {
|
||||
let attributeValue = element.getAttribute(aAttribute);
|
||||
|
@ -203,6 +201,9 @@ function search(aQuery, aAttribute) {
|
|||
} else {
|
||||
element.hidden = true;
|
||||
}
|
||||
} else if (element.getAttribute("data-hidden-from-search") == "true" &&
|
||||
!element.hidden) {
|
||||
element.hidden = true;
|
||||
}
|
||||
element.classList.remove("visually-hidden");
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ skip-if = !updater
|
|||
[browser_bug410900.js]
|
||||
[browser_bug705422.js]
|
||||
[browser_bug731866.js]
|
||||
[browser_search_no_results_change_category.js]
|
||||
[browser_search_within_preferences_1.js]
|
||||
[browser_search_within_preferences_2.js]
|
||||
[browser_search_within_preferences_command.js]
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
"use strict";
|
||||
|
||||
add_task(async function() {
|
||||
await SpecialPowers.pushPrefEnv({"set": [["browser.preferences.search", true]]});
|
||||
});
|
||||
|
||||
add_task(async function() {
|
||||
await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true});
|
||||
|
||||
let searchInput = gBrowser.contentDocument.getElementById("searchInput");
|
||||
is(searchInput, gBrowser.contentDocument.activeElement.closest("#searchInput"),
|
||||
"Search input should be focused when visiting preferences");
|
||||
let query = "ffff____noresults____ffff";
|
||||
let searchCompletedPromise = BrowserTestUtils.waitForEvent(
|
||||
gBrowser.contentWindow, "PreferencesSearchCompleted", evt => evt.detail == query);
|
||||
EventUtils.sendString(query);
|
||||
await searchCompletedPromise;
|
||||
|
||||
let noResultsEl = gBrowser.contentDocument.querySelector("#no-results-message");
|
||||
is_element_visible(noResultsEl, "Should be reporting no results for this query");
|
||||
|
||||
let privacyCategory = gBrowser.contentDocument.querySelector("#category-privacy");
|
||||
privacyCategory.click();
|
||||
is_element_hidden(noResultsEl,
|
||||
"Should not be showing the 'no results' message after selecting a category");
|
||||
|
||||
BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
});
|
Загрузка…
Ссылка в новой задаче