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
This commit is contained in:
abaevbog 2024-05-01 01:11:15 -04:00 committed by GitHub
parent 63012a816f
commit fa647459ac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 4 deletions

View file

@ -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) {

View file

@ -492,3 +492,5 @@ quicksearch-mode =
.aria-label = Quick Search mode
quicksearch-input =
.aria-label = Quick Search
.placeholder = { $placeholder }
.aria-description = { $placeholder }