diff --git a/chrome/content/zotero/preferences/preferences.js b/chrome/content/zotero/preferences/preferences.js index 27fc556d4e..b9a9200425 100644 --- a/chrome/content/zotero/preferences/preferences.js +++ b/chrome/content/zotero/preferences/preferences.js @@ -218,6 +218,7 @@ var Zotero_Preferences = { this.navigation.append(listItem); let container = document.createElement('div'); + container.classList.add('pane-container'); container.hidden = true; this.helpContainer.before(container); @@ -276,8 +277,13 @@ var Zotero_Preferences = { let heading = document.createElement('h1'); heading.textContent = pane.rawLabel; - pane.container.append(heading); pane.container.append(contentFragment); + if (pane.container.querySelector('.main-section')) { + pane.container.querySelector('.main-section').prepend(heading); + } + else { + pane.container.prepend(heading); + } await document.l10n.ready; await document.l10n.translateFragment(pane.container); @@ -585,12 +591,13 @@ ${str} let termForDisplay = Zotero.Utilities.trimInternal(term).toLowerCase(); term = this._normalizeSearch(term); - for (let container of this.content.children) { - let root = container.firstElementChild; - if (!root) continue; - - for (let child of root.children) { - let matches = await this._findNodesMatching(child, term); + for (let paneContainer of this.content.querySelectorAll(':scope > .pane-container')) { + let roots = paneContainer.children; + while (roots.length === 1 && roots[0].childElementCount) { + roots = roots[0].children; + } + for (let root of roots) { + let matches = await this._findNodesMatching(root, term); if (matches.length) { let touchedTabPanels = new Set(); for (let node of matches) { @@ -642,10 +649,14 @@ ${str} } } else { - child.classList.add('hidden-by-search'); - child.ariaHidden = true; + root.classList.add('hidden-by-search'); + root.ariaHidden = true; } } + if (Array.from(roots).every(root => root.classList.contains('hidden-by-search'))) { + paneContainer.classList.add('hidden-by-search'); + paneContainer.ariaHidden = true; + } } }), diff --git a/chrome/content/zotero/preferences/preferences_general.xhtml b/chrome/content/zotero/preferences/preferences_general.xhtml index 496da87197..db2a78476e 100644 --- a/chrome/content/zotero/preferences/preferences_general.xhtml +++ b/chrome/content/zotero/preferences/preferences_general.xhtml @@ -203,18 +203,18 @@