mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 06:43:32 +00:00
Bug 1864606 - Fix missing label association for crash reports checkbox r=fluent-reviewers,Gijs,bolsson
Thanks to mhowell for the STRIP_ANCHOR function in the Fluent migration. We were using the "for" attribute on a XUL label which does not behave like an HTML label. This prevented the programmatic association between the checkbox and the label. By utilizing moz-label, we maintain the accesskey behavior of the previous XUL label. Additionally we use moz-support-link to remove the "collection-backlogged-crash-reports-link" Fluent string. Differential Revision: https://phabricator.services.mozilla.com/D204557
This commit is contained in:
parent
39f5d902e5
commit
5168436b5f
@ -414,12 +414,12 @@ var gSearchResultsPane = {
|
||||
let matchesFound = false;
|
||||
if (
|
||||
nodeObject.childElementCount == 0 ||
|
||||
nodeObject.tagName == "button" ||
|
||||
nodeObject.tagName == "label" ||
|
||||
nodeObject.tagName == "description" ||
|
||||
nodeObject.tagName == "menulist" ||
|
||||
nodeObject.tagName == "menuitem" ||
|
||||
nodeObject.tagName == "checkbox" ||
|
||||
nodeObject.localName == "button" ||
|
||||
nodeObject.localName == "label" ||
|
||||
nodeObject.localName == "description" ||
|
||||
nodeObject.localName == "menulist" ||
|
||||
nodeObject.localName == "menuitem" ||
|
||||
nodeObject.localName == "checkbox" ||
|
||||
nodeObject.localName == "moz-toggle"
|
||||
) {
|
||||
let simpleTextNodes = this.textNodeDescendants(nodeObject);
|
||||
@ -446,8 +446,8 @@ var gSearchResultsPane = {
|
||||
let accessKeyTextNodes = [];
|
||||
|
||||
if (
|
||||
nodeObject.tagName == "label" ||
|
||||
nodeObject.tagName == "description"
|
||||
nodeObject.localName == "label" ||
|
||||
nodeObject.localName == "description"
|
||||
) {
|
||||
accessKeyTextNodes.push(...simpleTextNodes);
|
||||
}
|
||||
@ -475,7 +475,7 @@ var gSearchResultsPane = {
|
||||
// Searching some elements, such as xul:label, store their user-visible text in a "value" attribute.
|
||||
// Value will be skipped for menuitem since value in menuitem could represent index number to distinct each item.
|
||||
let valueResult =
|
||||
nodeObject.tagName !== "menuitem" && nodeObject.tagName !== "radio"
|
||||
nodeObject.localName !== "menuitem" && nodeObject.localName !== "radio"
|
||||
? this.queryMatchesContent(
|
||||
nodeObject.getAttribute("value"),
|
||||
searchPhrase
|
||||
@ -503,12 +503,13 @@ var gSearchResultsPane = {
|
||||
// Creating tooltips for buttons
|
||||
if (
|
||||
keywordsResult &&
|
||||
(nodeObject.tagName === "button" || nodeObject.tagName == "menulist")
|
||||
(nodeObject.localName === "button" ||
|
||||
nodeObject.localName == "menulist")
|
||||
) {
|
||||
this.listSearchTooltips.add(nodeObject);
|
||||
}
|
||||
|
||||
if (keywordsResult && nodeObject.tagName === "menuitem") {
|
||||
if (keywordsResult && nodeObject.localName === "menuitem") {
|
||||
nodeObject.setAttribute("indicator", "true");
|
||||
this.listSearchMenuitemIndicators.add(nodeObject);
|
||||
let menulist = nodeObject.closest("menulist");
|
||||
@ -518,8 +519,8 @@ var gSearchResultsPane = {
|
||||
}
|
||||
|
||||
if (
|
||||
(nodeObject.tagName == "menulist" ||
|
||||
nodeObject.tagName == "menuitem") &&
|
||||
(nodeObject.localName == "menulist" ||
|
||||
nodeObject.localName == "menuitem") &&
|
||||
(labelResult || valueResult || keywordsResult)
|
||||
) {
|
||||
nodeObject.setAttribute("highlightable", "true");
|
||||
@ -535,7 +536,7 @@ var gSearchResultsPane = {
|
||||
|
||||
// Should not search unselected child nodes of a <xul:deck> element
|
||||
// except the "historyPane" <xul:deck> element.
|
||||
if (nodeObject.tagName == "deck" && nodeObject.id != "historyPane") {
|
||||
if (nodeObject.localName == "deck" && nodeObject.id != "historyPane") {
|
||||
let index = nodeObject.selectedIndex;
|
||||
if (index != -1) {
|
||||
let result = await this.searchChildNodeIfVisible(
|
||||
@ -578,7 +579,7 @@ var gSearchResultsPane = {
|
||||
) {
|
||||
result = await this.searchWithinNode(child, searchPhrase);
|
||||
// Creating tooltips for menulist element
|
||||
if (result && nodeObject.tagName === "menulist") {
|
||||
if (result && nodeObject.localName === "menulist") {
|
||||
this.listSearchTooltips.add(nodeObject);
|
||||
}
|
||||
|
||||
|
@ -84,6 +84,7 @@
|
||||
<script src="chrome://browser/content/migration/migration-wizard.mjs" type="module"></script>
|
||||
<script type="module" src="chrome://global/content/elements/moz-toggle.mjs"/>
|
||||
<script type="module" src="chrome://global/content/elements/moz-message-bar.mjs" />
|
||||
<script type="module" src="chrome://global/content/elements/moz-label.mjs"/>
|
||||
</head>
|
||||
|
||||
<html:body xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
|
@ -985,11 +985,12 @@
|
||||
<html:input type="checkbox"
|
||||
id="automaticallySubmitCrashesBox"
|
||||
preference="browser.crashReports.unsubmittedCheck.autoSubmit2"/>
|
||||
<label for="automaticallySubmitCrashesBox"
|
||||
<html:label is="moz-label"
|
||||
for="automaticallySubmitCrashesBox"
|
||||
id="crashReporterLabel"
|
||||
data-l10n-id="collection-backlogged-crash-reports-with-link">
|
||||
<html:a data-l10n-name="crash-reports-link" id="crashReporterLearnMore" target="_blank"/>
|
||||
</label>
|
||||
data-l10n-id="collection-backlogged-crash-reports"
|
||||
data-l10n-attrs="accesskey"/>
|
||||
<html:a id="crashReporterLearnMore" is="moz-support-link" class="learnMore"/>
|
||||
</hbox>
|
||||
#endif
|
||||
</vbox>
|
||||
|
@ -3230,13 +3230,6 @@ var gPrivacyPane = {
|
||||
"toolkit.crashreporter.infoURL",
|
||||
"crashReporterLearnMore"
|
||||
);
|
||||
setEventListener("crashReporterLabel", "click", function (event) {
|
||||
if (event.target.localName == "a") {
|
||||
return;
|
||||
}
|
||||
const checkboxId = event.target.getAttribute("for");
|
||||
document.getElementById(checkboxId).click();
|
||||
});
|
||||
},
|
||||
|
||||
initPrivacySegmentation() {
|
||||
|
@ -1442,7 +1442,7 @@ addon-recommendations-link = Learn more
|
||||
# or builds with no Telemetry support available.
|
||||
collection-health-report-disabled = Data reporting is disabled for this build configuration
|
||||
|
||||
collection-backlogged-crash-reports-with-link = Allow { -brand-short-name } to send backlogged crash reports on your behalf <a data-l10n-name="crash-reports-link">Learn more</a>
|
||||
collection-backlogged-crash-reports = Allow { -brand-short-name } to send backlogged crash reports on your behalf
|
||||
.accesskey = c
|
||||
|
||||
privacy-segmentation-section-header = New features that enhance your browsing
|
||||
|
@ -0,0 +1,41 @@
|
||||
# Any copyright is dedicated to the Public Domain.
|
||||
# http://creativecommons.org/publicdomain/zero/1.0/
|
||||
|
||||
import re
|
||||
import fluent.syntax.ast as FTL
|
||||
from fluent.migrate.transforms import TransformPattern, COPY_PATTERN
|
||||
|
||||
|
||||
class STRIP_ANCHOR(TransformPattern):
|
||||
# Used to remove `<a data-l10n-name="crash-reports-link">[...]</a>` from a string
|
||||
def visit_TextElement(self, node):
|
||||
node.value = re.sub(
|
||||
' *<a data-l10n-name="crash-reports-link">.*</a>', "", node.value
|
||||
)
|
||||
return node
|
||||
|
||||
|
||||
def migrate(ctx):
|
||||
"""Bug 1864606 - Standardize the backlogged crash reports checkbox implementation, part {index}."""
|
||||
preferences_ftl = "browser/browser/preferences/preferences.ftl"
|
||||
ctx.add_transforms(
|
||||
preferences_ftl,
|
||||
preferences_ftl,
|
||||
[
|
||||
FTL.Message(
|
||||
id=FTL.Identifier("collection-backlogged-crash-reports"),
|
||||
attributes=[
|
||||
FTL.Attribute(
|
||||
id=FTL.Identifier("accesskey"),
|
||||
value=COPY_PATTERN(
|
||||
preferences_ftl,
|
||||
"collection-backlogged-crash-reports-with-link.accesskey",
|
||||
),
|
||||
),
|
||||
],
|
||||
value=STRIP_ANCHOR(
|
||||
preferences_ftl, "collection-backlogged-crash-reports-with-link"
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
Loading…
Reference in New Issue
Block a user