[tbb-commits] [Git][tpo/applications/tor-browser][tor-browser-115.0esrbase-13.0-1] fixup! Bug 41698: Reword the recommendation badges in about:addons
ma1 (@ma1)
git at gitlab.torproject.org
Tue Jul 11 14:39:02 UTC 2023
ma1 pushed to branch tor-browser-115.0esrbase-13.0-1 at The Tor Project / Applications / Tor Browser
Commits:
a884f352 by hackademix at 2023-07-11T15:48:11+02:00
fixup! Bug 41698: Reword the recommendation badges in about:addons
- - - - -
3 changed files:
- toolkit/content/widgets/moz-support-link/moz-support-link.mjs
- toolkit/mozapps/extensions/content/aboutaddons.html
- toolkit/mozapps/extensions/content/aboutaddons.js
Changes:
=====================================
toolkit/content/widgets/moz-support-link/moz-support-link.mjs
=====================================
@@ -52,6 +52,23 @@ export default class MozSupportLink extends HTMLAnchorElement {
this.setAttribute("target", "_blank");
this.addEventListener("click", this);
if (!this.getAttribute("data-l10n-id")) {
+ const fixupL10nId = this.getAttribute("data-basebrowser-l10n-fixup");
+ if (fixupL10nId) {
+ document.l10n.formatValue(fixupL10nId).then(title => {
+ this.setAttribute("title", title);
+ // NOTE: Mozilla adds identical aria-label and title attributes. This is
+ // generally bad practice because this link has no text content, so the
+ // title alone will already act as the accessible name.
+ // Normally setting both aria-label and title will lead to the title being
+ // used as the accessible description, but since they are identical
+ // the LocalAccessible::Description method will make an exception and keep
+ // the description empty.
+ // Since this component is outside of our fork's control, we follow the
+ // same practice just in case Mozilla ever adds some text content.
+ this.setAttribute("aria-label", title);
+ });
+ return;
+ }
document.l10n.setAttributes(this, "moz-support-link-text");
}
document.l10n.translateFragment(this);
=====================================
toolkit/mozapps/extensions/content/aboutaddons.html
=====================================
@@ -359,6 +359,7 @@
is="moz-support-link"
support-page="add-on-badges"
utm-content="promoted-addon-badge"
+ data-basebrowser-l10n-fixup="basebrowser-addon-badge-recommended"
hidden
>
</a>
@@ -376,6 +377,7 @@
is="moz-support-link"
support-page="add-on-badges"
utm-content="promoted-addon-badge"
+ data-basebrowser-l10n-fixup="basebrowser-addon-badge-verified"
hidden
>
</a>
=====================================
toolkit/mozapps/extensions/content/aboutaddons.js
=====================================
@@ -4220,29 +4220,6 @@ async function initialize() {
);
}
}
-
- // At the moment we need to do this, because Weblate still does not support
- // attributes in Fluent.
- const [recommended, verified] = await document.l10n.formatValues([
- { id: "basebrowser-addon-badge-recommended" },
- { id: "basebrowser-addon-badge-verified" },
- ]);
-
- importTemplate("card");
- _templates.card.content
- .querySelector(".addon-badge-recommended")
- .setAttribute("title", recommended);
- _templates.card.content
- .querySelector(".addon-badge-verified")
- .setAttribute("title", verified);
-
- // We also update any template copy that has already been created.
- for (const badge of document.querySelectorAll(".addon-badge-recommended")) {
- badge.setAttribute("title", recommended);
- }
- for (const badge of document.querySelectorAll(".addon-badge-verified")) {
- badge.setAttribute("title", verified);
- }
}
window.promiseInitialized = new Promise(resolve => {
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/a884f352ec0a3f43c96765b3a5598bdfacc6f42e
--
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/a884f352ec0a3f43c96765b3a5598bdfacc6f42e
You're receiving this email because of your account on gitlab.torproject.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.torproject.org/pipermail/tbb-commits/attachments/20230711/7cb193f3/attachment-0001.htm>
More information about the tbb-commits
mailing list