Loading toolkit/content/widgets/moz-support-link/moz-support-link.mjs +17 −0 Original line number Diff line number Diff line Loading @@ -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); Loading toolkit/mozapps/extensions/content/aboutaddons.html +2 −0 Original line number Diff line number Diff line Loading @@ -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> Loading @@ -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> Loading toolkit/mozapps/extensions/content/aboutaddons.js +0 −23 Original line number Diff line number Diff line Loading @@ -4219,29 +4219,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 => { Loading Loading
toolkit/content/widgets/moz-support-link/moz-support-link.mjs +17 −0 Original line number Diff line number Diff line Loading @@ -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); Loading
toolkit/mozapps/extensions/content/aboutaddons.html +2 −0 Original line number Diff line number Diff line Loading @@ -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> Loading @@ -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> Loading
toolkit/mozapps/extensions/content/aboutaddons.js +0 −23 Original line number Diff line number Diff line Loading @@ -4219,29 +4219,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 => { Loading