From fa647459acfdc53c3ae05bf7746ef2c1b2657445 Mon Sep 17 00:00:00 2001 From: abaevbog Date: Wed, 1 May 2024 01:11:15 -0400 Subject: [PATCH] set quicksearch placeholder as fluent argument (#4074) Fluent seems to clear out label/placeholders attributes set directly (not via .ftl file). So quicksearch placeholder added directly ends up being emptied out. This is the cleanest workaround found so far: add the placeholder as the fluent argument Fixes: #4073 --- chrome/content/zotero/elements/quickSearchTextbox.js | 5 +---- chrome/locale/en-US/zotero/zotero.ftl | 2 ++ 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/chrome/content/zotero/elements/quickSearchTextbox.js b/chrome/content/zotero/elements/quickSearchTextbox.js index dfed5ea5f5..b8c7e2dd8a 100644 --- a/chrome/content/zotero/elements/quickSearchTextbox.js +++ b/chrome/content/zotero/elements/quickSearchTextbox.js @@ -87,7 +87,6 @@ dropmarkerShadow.append(s1, s2, dropmarker); let searchBox = document.createXULElement("search-textbox"); - searchBox.inputField.setAttribute("data-l10n-id", "quicksearch-input"); searchBox.id = "zotero-tb-search-textbox"; this.searchTextbox = searchBox; @@ -153,9 +152,7 @@ this.searchModePopup.querySelector(`menuitem[value="${mode}"]`) .setAttribute('checked', 'true'); - this.searchTextbox.placeholder = this._searchModes[mode]; - // Have the placeholder announced by screen readers after the label for additional context - this.searchTextbox.inputField.setAttribute("aria-description", this.searchTextbox.placeholder); + document.l10n.setAttributes(this.searchTextbox.inputField, "quicksearch-input", { placeholder: this._searchModes[mode] }); } _id(id) { diff --git a/chrome/locale/en-US/zotero/zotero.ftl b/chrome/locale/en-US/zotero/zotero.ftl index e9d41c7442..e499d3b306 100644 --- a/chrome/locale/en-US/zotero/zotero.ftl +++ b/chrome/locale/en-US/zotero/zotero.ftl @@ -492,3 +492,5 @@ quicksearch-mode = .aria-label = Quick Search mode quicksearch-input = .aria-label = Quick Search + .placeholder = { $placeholder } + .aria-description = { $placeholder }